diff options
Diffstat (limited to 'filter')
-rw-r--r-- | filter/filterinterface.go (renamed from filter/interface.go) | 0 | ||||
-rw-r--r-- | filter/http/http.go (renamed from filter/http.go) | 11 | ||||
-rw-r--r-- | filter/str/string.go (renamed from filter/string.go) | 4 |
3 files changed, 11 insertions, 4 deletions
diff --git a/filter/interface.go b/filter/filterinterface.go index 83d2dfe..83d2dfe 100644 --- a/filter/interface.go +++ b/filter/filterinterface.go diff --git a/filter/http.go b/filter/http/http.go index 97fffa7..e3d447b 100644 --- a/filter/http.go +++ b/filter/http/http.go @@ -1,18 +1,25 @@ -package filter +package http import ( "bytes" "io/ioutil" "net/http" + "github.com/Shugyousha/stasher/filter" + "github.com/Shugyousha/stasher/registry" "github.com/Shugyousha/stasher/work" ) +func init() { + registry.Filterregistry["http"] = New +} + type HTTPFilter struct { url string } -func NewHTTPFilter(url string) *HTTPFilter { +func New(kv map[string]string) filter.Filter { + url := kv["url"] return &HTTPFilter{url: url} } diff --git a/filter/string.go b/filter/str/string.go index cb44d75..0ae407d 100644 --- a/filter/string.go +++ b/filter/str/string.go @@ -1,4 +1,4 @@ -package filter +package str import ( "bytes" @@ -13,7 +13,7 @@ type StringFilter struct { FilterFuncMap map[string]func(string) string } -func NewStringFilter(ffmap map[string]func(string) string) *StringFilter { +func New(ffmap map[string]func(string) string) *StringFilter { return &StringFilter{FilterFuncMap: ffmap} } |