summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorSilvan Jegen <s.jegen@gmail.com>2017-01-21 12:34:51 +0100
committerSilvan Jegen <s.jegen@gmail.com>2017-01-21 12:34:51 +0100
commit2eb6ecf4e9d8040bd2a698dbfa80bcd45b0c371e (patch)
tree732693efaf7e9c925a79a8cf412ceb2714d98b3c /filter
parent5c24009f2b1fd5a7e5abd4dc33ebdec0c6eaaf25 (diff)
Use the registry for filter modules as well
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}
}