Skip to content

Commit

Permalink
config: make LoopbackAddressesOnLanDHT a Flag
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias authored and lidel committed Apr 4, 2024
1 parent 34fbe89 commit 90b0f7a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ is useful when using the daemon in test environments.`,
}

c.Swarm.DisableNatPortMap = true
c.Routing.LoopbackAddressesOnLanDHT = true
c.Routing.LoopbackAddressesOnLanDHT = True

c.Bootstrap = []string{}
c.Discovery.MDNS.Enabled = false
Expand Down
2 changes: 1 addition & 1 deletion config/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Routing struct {

AcceleratedDHTClient Flag `json:",omitempty"`

LoopbackAddressesOnLanDHT bool
LoopbackAddressesOnLanDHT Flag `json:",omitempty"`

Routers Routers

Expand Down
2 changes: 1 addition & 1 deletion core/node/libp2p/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func Host(mctx helpers.MetricsCtx, lc fx.Lifecycle, params P2PHostIn) (out P2PHo
BootstrapPeers: bootstrappers,
OptimisticProvide: cfg.Experimental.OptimisticProvide,
OptimisticProvideJobsPoolSize: cfg.Experimental.OptimisticProvideJobsPoolSize,
LoopbackAddressesOnLanDHT: cfg.Routing.LoopbackAddressesOnLanDHT,
LoopbackAddressesOnLanDHT: cfg.Routing.LoopbackAddressesOnLanDHT.WithDefault(false),
}
opts = append(opts, libp2p.Routing(func(h host.Host) (routing.PeerRouting, error) {
args := routingOptArgs
Expand Down
2 changes: 2 additions & 0 deletions docs/changelogs/v0.28.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ The Object API commands deprecated back in [2021](https://github.com/ipfs/kubo/i

Kubo no longer keeps track of loopback and private addresses on the LAN and WAN DHTs, respectively. This means that other nodes will not try to dial likely undialable addresses.

To support testing scenarios where multiple Kubo instances run on the same machine, [`Routing.LoopbackAddressesOnLanDHT`](https://github.com/ipfs/kubo/blob/master/docs/config.md#routingloopbackaddressesonlandht) is set to `true` when the `test` profile is applied.

### πŸ“ Changelog

### πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦ Contributors
2 changes: 1 addition & 1 deletion test/cli/harness/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (n *Node) Init(ipfsArgs ...string) *Node {
cfg.Addresses.Gateway = []string{n.GatewayListenAddr.String()}
cfg.Swarm.DisableNatPortMap = true
cfg.Discovery.MDNS.Enabled = n.EnableMDNS
cfg.Routing.LoopbackAddressesOnLanDHT = true
cfg.Routing.LoopbackAddressesOnLanDHT = config.True
})
return n
}
Expand Down

0 comments on commit 90b0f7a

Please sign in to comment.