From aff906d734cdff279c7c7cfd17ccc54f70c6c45f Mon Sep 17 00:00:00 2001 From: genofire Date: Tue, 16 Jun 2020 23:30:54 +0200 Subject: [PATCH] black lives matter --- config_example.toml | 4 ++-- docs/docs_configuration.md | 10 +++++----- output/all/filter.go | 2 +- output/all/output_test.go | 2 +- .../{blacklist/blacklist.go => blocklist/blocklist.go} | 10 +++++----- .../blacklist_test.go => blocklist/blocklist_test.go} | 10 +++++----- 6 files changed, 19 insertions(+), 19 deletions(-) rename output/filter/{blacklist/blacklist.go => blocklist/blocklist.go} (78%) rename output/filter/{blacklist/blacklist_test.go => blocklist/blocklist_test.go} (79%) diff --git a/config_example.toml b/config_example.toml index e7cab4a..ab280ea 100644 --- a/config_example.toml +++ b/config_example.toml @@ -78,7 +78,7 @@ offline_after = "10m" #no_owner = true # # List of nodeids of nodes that should be filtered out, so they won't appear in output -#blacklist = ["00112233445566", "1337f0badead"] +#blocklist = ["00112233445566", "1337f0badead"] # # List of site_codes of nodes that should be included in the output #sites = ["ffhb"] @@ -116,7 +116,7 @@ path = "/var/www/html/meshviewer/data/meshviewer.json" [nodes.output.meshviewer-ffrgb.filter] # WARNING: if it is not set, it will publish contact information of other persons no_owner = false -#blacklist = ["00112233445566", "1337f0badead"] +#blocklist = ["00112233445566", "1337f0badead"] #sites = ["ffhb"] #has_location = true diff --git a/docs/docs_configuration.md b/docs/docs_configuration.md index c2317b5..f72fbcd 100644 --- a/docs/docs_configuration.md +++ b/docs/docs_configuration.md @@ -282,7 +282,7 @@ It is possible to have multiple output for one type of output, just add this gro enable = true [nodes.output.example.filter] no_owner = true -blacklist = ["00112233445566", "1337f0badead"] +blocklist = ["00112233445566", "1337f0badead"] sites = ["ffhb"] domain_as_site = true domain_append_site = true @@ -311,7 +311,7 @@ For each output format there can be set different filters ```toml [nodes.output.example.filter] no_owner = true -blacklist = ["00112233445566", "1337f0badead"] +blocklist = ["00112233445566", "1337f0badead"] sites = ["ffhb"] has_location = true [nodes.output.example.filter.in_area] @@ -337,12 +337,12 @@ no_owner = true {% endmethod %} -### blacklist +### blocklist {% method %} List of nodeids of nodes that should be filtered out, so they won't appear in output {% sample lang="toml" %} ```toml -blacklist = ["00112233445566", "1337f0badead"] +blocklist = ["00112233445566", "1337f0badead"] ``` {% endmethod %} @@ -448,7 +448,7 @@ enable = true path = "/var/www/html/meshviewer/data/meshviewer.json" #[nodes.output.meshviewer-ffrgb.filter] #no_owner = false -#blacklist = ["00112233445566", "1337f0badead"] +#blocklist = ["00112233445566", "1337f0badead"] #has_location = true #[nodes.output.meshviewer-ffrgb.filter.in_area] diff --git a/output/all/filter.go b/output/all/filter.go index 72b114c..3f2f632 100644 --- a/output/all/filter.go +++ b/output/all/filter.go @@ -1,7 +1,7 @@ package all import ( - _ "github.com/FreifunkBremen/yanic/output/filter/blacklist" + _ "github.com/FreifunkBremen/yanic/output/filter/blocklist" _ "github.com/FreifunkBremen/yanic/output/filter/domainappendsite" _ "github.com/FreifunkBremen/yanic/output/filter/domainassite" _ "github.com/FreifunkBremen/yanic/output/filter/haslocation" diff --git a/output/all/output_test.go b/output/all/output_test.go index f30ceb0..a5fece3 100644 --- a/output/all/output_test.go +++ b/output/all/output_test.go @@ -112,7 +112,7 @@ func TestStart(t *testing.T) { map[string]interface{}{ "enable": true, "filter": map[string]interface{}{ - "blacklist": true, + "blocklist": true, }, }, }, diff --git a/output/filter/blacklist/blacklist.go b/output/filter/blocklist/blocklist.go similarity index 78% rename from output/filter/blacklist/blacklist.go rename to output/filter/blocklist/blocklist.go index 9298a88..dfe36e8 100644 --- a/output/filter/blacklist/blacklist.go +++ b/output/filter/blocklist/blocklist.go @@ -1,4 +1,4 @@ -package blacklist +package blocklist import ( "errors" @@ -7,10 +7,10 @@ import ( "github.com/FreifunkBremen/yanic/runtime" ) -type blacklist map[string]interface{} +type blocklist map[string]interface{} func init() { - filter.Register("blacklist", build) + filter.Register("blocklist", build) } func build(config interface{}) (filter.Filter, error) { @@ -19,7 +19,7 @@ func build(config interface{}) (filter.Filter, error) { return nil, errors.New("invalid configuration, array (of strings) expected") } - list := make(blacklist) + list := make(blocklist) for _, value := range values { if nodeid, ok := value.(string); ok { list[nodeid] = struct{}{} @@ -30,7 +30,7 @@ func build(config interface{}) (filter.Filter, error) { return &list, nil } -func (list blacklist) Apply(node *runtime.Node) *runtime.Node { +func (list blocklist) Apply(node *runtime.Node) *runtime.Node { if nodeinfo := node.Nodeinfo; nodeinfo != nil { if _, ok := list[nodeinfo.NodeID]; ok { return nil diff --git a/output/filter/blacklist/blacklist_test.go b/output/filter/blocklist/blocklist_test.go similarity index 79% rename from output/filter/blacklist/blacklist_test.go rename to output/filter/blocklist/blocklist_test.go index f2e2855..89b5d38 100644 --- a/output/filter/blacklist/blacklist_test.go +++ b/output/filter/blocklist/blocklist_test.go @@ -1,4 +1,4 @@ -package blacklist +package blocklist import ( "testing" @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestFilterBlacklist(t *testing.T) { +func TestFilterBlocklist(t *testing.T) { assert := assert.New(t) // invalid config @@ -26,15 +26,15 @@ func TestFilterBlacklist(t *testing.T) { n := filter.Apply(&runtime.Node{Nodeinfo: &data.Nodeinfo{}}) assert.NotNil(n) - // tests with blacklist + // tests with blocklist filter, err = build([]interface{}{"a", "c"}) assert.NoError(err) - // blacklist contains node with nodeid -> drop it + // blocklist contains node with nodeid -> drop it n = filter.Apply(&runtime.Node{Nodeinfo: &data.Nodeinfo{NodeID: "a"}}) assert.Nil(n) - // blacklist does not contains node without nodeid -> keep it + // blocklist does not contains node without nodeid -> keep it n = filter.Apply(&runtime.Node{Nodeinfo: &data.Nodeinfo{}}) assert.NotNil(n)