提交 c595cf8a 作者: Juan Batiz-Benet

config: DialBlocklist -> Swarm.AddrFilters

This commit changes the DialBlocklist key to be under the key
Swarm.AddrFilters instead.

License: MIT
Signed-off-by: 's avatarJuan Batiz-Benet <juan@benet.ai>
上级 a119b722
...@@ -378,7 +378,7 @@ Where the above is equivalent to the standard CIDR: ...@@ -378,7 +378,7 @@ Where the above is equivalent to the standard CIDR:
192.168.0.0/16 192.168.0.0/16
Filters default to those specified under the "DialBlocklist" config key. Filters default to those specified under the "Swarm.AddrFilters" config key.
`, `,
}, },
Subcommands: map[string]*cmds.Command{ Subcommands: map[string]*cmds.Command{
...@@ -419,7 +419,7 @@ var swarmFiltersAddCmd = &cmds.Command{ ...@@ -419,7 +419,7 @@ var swarmFiltersAddCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "add an address filter", Tagline: "add an address filter",
ShortDescription: ` ShortDescription: `
'ipfs swarm filters add' will add an address filter to the daemons swarm. 'ipfs swarm filters add' will add an address filter to the daemons swarm.
Filters applied this way will not persist daemon reboots, to acheive that, Filters applied this way will not persist daemon reboots, to acheive that,
add your filters to the ipfs config file. add your filters to the ipfs config file.
`, `,
...@@ -456,7 +456,7 @@ var swarmFiltersRmCmd = &cmds.Command{ ...@@ -456,7 +456,7 @@ var swarmFiltersRmCmd = &cmds.Command{
Helptext: cmds.HelpText{ Helptext: cmds.HelpText{
Tagline: "remove an address filter", Tagline: "remove an address filter",
ShortDescription: ` ShortDescription: `
'ipfs swarm filters rm' will remove an address filter from the daemons swarm. 'ipfs swarm filters rm' will remove an address filter from the daemons swarm.
Filters removed this way will not persist daemon reboots, to acheive that, Filters removed this way will not persist daemon reboots, to acheive that,
remove your filters from the ipfs config file. remove your filters from the ipfs config file.
`, `,
......
...@@ -258,7 +258,7 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin ...@@ -258,7 +258,7 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
// get undialable addrs from config // get undialable addrs from config
cfg := n.Repo.Config() cfg := n.Repo.Config()
var addrfilter []*net.IPNet var addrfilter []*net.IPNet
for _, s := range cfg.DialBlocklist { for _, s := range cfg.Swarm.AddrFilters {
f, err := mamask.NewMask(s) f, err := mamask.NewMask(s)
if err != nil { if err != nil {
return fmt.Errorf("incorrectly formatter address filter in config: %s", s) return fmt.Errorf("incorrectly formatter address filter in config: %s", s)
......
...@@ -26,7 +26,7 @@ type Config struct { ...@@ -26,7 +26,7 @@ type Config struct {
Tour Tour // local node's tour position Tour Tour // local node's tour position
Gateway Gateway // local node's gateway server options Gateway Gateway // local node's gateway server options
SupernodeRouting SupernodeClientConfig // local node's routing servers (if SupernodeRouting enabled) SupernodeRouting SupernodeClientConfig // local node's routing servers (if SupernodeRouting enabled)
DialBlocklist []string Swarm SwarmConfig
Log Log Log Log
} }
......
package config
type SwarmConfig struct {
AddrFilters []string
}
...@@ -32,7 +32,7 @@ test_swarm_filter_cmd() { ...@@ -32,7 +32,7 @@ test_swarm_filter_cmd() {
} }
test_swarm_filters() { test_swarm_filters() {
# expect first address from config # expect first address from config
test_swarm_filter_cmd $AF1 $AF4 test_swarm_filter_cmd $AF1 $AF4
...@@ -53,7 +53,7 @@ test_swarm_filters() { ...@@ -53,7 +53,7 @@ test_swarm_filters() {
test_swarm_filter_cmd $AF1 test_swarm_filter_cmd $AF1
test_expect_success "'ipfs swarm filter add' succeeds" ' test_expect_success "'ipfs swarm filter add' succeeds" '
ipfs swarm filters add $AF4 $AF2 ipfs swarm filters add $AF4 $AF2
' '
test_swarm_filter_cmd $AF1 $AF2 $AF4 test_swarm_filter_cmd $AF1 $AF2 $AF4
...@@ -72,7 +72,7 @@ test_expect_success "init without any filters" ' ...@@ -72,7 +72,7 @@ test_expect_success "init without any filters" '
' '
test_expect_success "adding addresses to the config to filter succeeds" ' test_expect_success "adding addresses to the config to filter succeeds" '
ipfs config --json DialBlocklist "[\"$AF1\", \"$AF4\"]" ipfs config --json Swarm.AddrFilters "[\"$AF1\", \"$AF4\"]"
' '
test_launch_ipfs_daemon test_launch_ipfs_daemon
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论