diff --git a/handlers/api_modifiers.go b/handlers/api_modifiers.go index 5ac8282..e797717 100644 --- a/handlers/api_modifiers.go +++ b/handlers/api_modifiers.go @@ -1 +1,64 @@ package handlers + +// TODO: this is a work in progress. +// Needs codegen to populate the rqm and rsm structs from available modifiers in ladder/proxychain/*modifers/*.go + +import ( + "ladder/proxychain/responsemodifiers/api" +) + +type ModifiersAPIResponse struct { + Success bool `json:"success"` + Error api.Error `json:"error"` + Result Modifiers `json:"result"` +} + +type Modifiers struct { + RequestModifiers []Modifier `json:"requestmodifiers"` + ResponseModifiers []Modifier `json:"responsemodifiers"` +} + +type Modifier struct { + Name string `json:"name"` + Description string `json:"description"` + Params []Param `json:"params"` +} + +type Param struct { + Name string `json:"name"` + Type string `json:"type"` +} + +func init() { + + rqm := []Modifier{} + + // ========= loop + rqm = append(rqm, Modifier{ + Name: "codegen_name", + Description: "codegen_description", + Params: []Param{ + {Name: "codegen_name1", Type: "codegen_type1"}, + {Name: "codegen_name2", Type: "codegen_type2"}, + }, + }) + // ========= loop end + + rsm := []Modifier{} + + // ========= loop + rsm = append(rsm, Modifier{ + Name: "codegen_name", + Description: "codegen_description", + Params: []Param{ + {Name: "codegen_name1", Type: "codegen_type1"}, + {Name: "codegen_name2", Type: "codegen_type2"}, + }, + }) + // ========= loop end + + m := &ModifiersAPIResponse{Success: true} + m.Result.RequestModifiers = rqm + m.Result.ResponseModifiers = rsm + +} diff --git a/proxychain/requestmodifiers/modify_query_params.go b/proxychain/requestmodifiers/modify_query_params.go index ba817ac..afdad39 100644 --- a/proxychain/requestmodifiers/modify_query_params.go +++ b/proxychain/requestmodifiers/modify_query_params.go @@ -1,7 +1,7 @@ package requestmodifiers import ( - "fmt" + //"fmt" "net/url" "ladder/proxychain" @@ -13,7 +13,7 @@ func ModifyQueryParams(key string, value string) proxychain.RequestModification return func(chain *proxychain.ProxyChain) error { q := chain.Request.URL.Query() chain.Request.URL.RawQuery = modifyQueryParams(key, value, q) - fmt.Println(chain.Request.URL.String()) + //fmt.Println(chain.Request.URL.String()) return nil } }