config: DialBlocklist -> Swarm.AddrFilters
This commit changes the DialBlocklist key to be under the key Swarm.AddrFilters instead. License: MIT Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
Juan Batiz-Benet committed
Jul 2, 2015 at 16:11 UTC
c595cf8ae00947e444c48c097921583e0b61498a
5 files changed
+13
-8
core/commands/swarm.go
+3
-3
@@ -378,7 +378,7 @@ Where the above is equivalent to the standard CIDR:
378
379
192.168.0.0/16
380
381
-Filters default to those specified under the "DialBlocklist" config key.
381
+Filters default to those specified under the "Swarm.AddrFilters" config key.
382
`,
383
},
384
Subcommands: map[string]*cmds.Command{
@@ -419,7 +419,7 @@ var swarmFiltersAddCmd = &cmds.Command{
419
Helptext: cmds.HelpText{
420
Tagline: "add an address filter",
421
ShortDescription: `
422
-'ipfs swarm filters add' will add an address filter to the daemons swarm.
422
+'ipfs swarm filters add' will add an address filter to the daemons swarm.
423
Filters applied this way will not persist daemon reboots, to acheive that,
424
add your filters to the ipfs config file.
425
`,
@@ -456,7 +456,7 @@ var swarmFiltersRmCmd = &cmds.Command{
456
Helptext: cmds.HelpText{
457
Tagline: "remove an address filter",
458
ShortDescription: `
459
-'ipfs swarm filters rm' will remove an address filter from the daemons swarm.
459
+'ipfs swarm filters rm' will remove an address filter from the daemons swarm.
460
Filters removed this way will not persist daemon reboots, to acheive that,
461
remove your filters from the ipfs config file.
462
`,
core/core.go
+1
-1
@@ -258,7 +258,7 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
258
// get undialable addrs from config
259
cfg := n.Repo.Config()
260
var addrfilter []*net.IPNet
261
- for _, s := range cfg.DialBlocklist {
261
+ for _, s := range cfg.Swarm.AddrFilters {
262
f, err := mamask.NewMask(s)
263
if err != nil {
264
return fmt.Errorf("incorrectly formatter address filter in config: %s", s)
repo/config/config.go
+1
-1
@@ -26,7 +26,7 @@ type Config struct {
26
Tour Tour // local node's tour position
27
Gateway Gateway // local node's gateway server options
28
SupernodeRouting SupernodeClientConfig // local node's routing servers (if SupernodeRouting enabled)
29
- DialBlocklist []string
29
+ Swarm SwarmConfig
30
Log Log
31
}
32
repo/config/swarm.go
new
+5
@@ -0,0 +1,5 @@
1
+package config
2
+
3
+type SwarmConfig struct {
4
+ AddrFilters []string
5
+}
test/sharness/t0141-addfilter.sh
+3
-3
@@ -32,7 +32,7 @@ test_swarm_filter_cmd() {
32
}
33
34
test_swarm_filters() {
35
-
35
+
36
# expect first address from config
37
test_swarm_filter_cmd $AF1 $AF4
38
@@ -53,7 +53,7 @@ test_swarm_filters() {
53
test_swarm_filter_cmd $AF1
54
55
test_expect_success "'ipfs swarm filter add' succeeds" '
56
- ipfs swarm filters add $AF4 $AF2
56
+ ipfs swarm filters add $AF4 $AF2
57
'
58
59
test_swarm_filter_cmd $AF1 $AF2 $AF4
@@ -72,7 +72,7 @@ test_expect_success "init without any filters" '
72
'
73
74
test_expect_success "adding addresses to the config to filter succeeds" '
75
- ipfs config --json DialBlocklist "[\"$AF1\", \"$AF4\"]"
75
+ ipfs config --json Swarm.AddrFilters "[\"$AF1\", \"$AF4\"]"
76
'
77
78
test_launch_ipfs_daemon