black lives matter

This commit is contained in:
genofire 2020-06-16 23:30:54 +02:00 committed by Julian Kornberger
parent e97e481516
commit aff906d734
6 changed files with 19 additions and 19 deletions

View File

@ -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

View File

@ -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]

View File

@ -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"

View File

@ -112,7 +112,7 @@ func TestStart(t *testing.T) {
map[string]interface{}{
"enable": true,
"filter": map[string]interface{}{
"blacklist": true,
"blocklist": true,
},
},
},

View File

@ -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

View File

@ -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)