Skip to content

Commit 2e44474

Browse files
committed
config: make LoopbackAddressesOnLanDHT a Flag
1 parent 225984e commit 2e44474

File tree

6 files changed

+7
-5
lines changed

6 files changed

+7
-5
lines changed

β€Žconfig/profile.goβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ is useful when using the daemon in test environments.`,
8282
}
8383

8484
c.Swarm.DisableNatPortMap = true
85-
c.Routing.LoopbackAddressesOnLanDHT = true
85+
c.Routing.LoopbackAddressesOnLanDHT = True
8686

8787
c.Bootstrap = []string{}
8888
c.Discovery.MDNS.Enabled = false

β€Žconfig/routing.goβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type Routing struct {
1717

1818
AcceleratedDHTClient bool
1919

20-
LoopbackAddressesOnLanDHT bool
20+
LoopbackAddressesOnLanDHT Flag `json:",omitempty"`
2121

2222
Routers Routers
2323

β€Žcore/node/libp2p/host.goβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func Host(mctx helpers.MetricsCtx, lc fx.Lifecycle, params P2PHostIn) (out P2PHo
6060
BootstrapPeers: bootstrappers,
6161
OptimisticProvide: cfg.Experimental.OptimisticProvide,
6262
OptimisticProvideJobsPoolSize: cfg.Experimental.OptimisticProvideJobsPoolSize,
63-
LoopbackAddressesOnLanDHT: cfg.Routing.LoopbackAddressesOnLanDHT,
63+
LoopbackAddressesOnLanDHT: cfg.Routing.LoopbackAddressesOnLanDHT.WithDefault(false),
6464
}
6565
opts = append(opts, libp2p.Routing(func(h host.Host) (routing.PeerRouting, error) {
6666
args := routingOptArgs

β€Ždocs/changelogs/v0.28.mdβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ The Object API commands deprecated back in [2021](https://github.com/ipfs/kubo/i
3333

3434
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.
3535

36+
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.
37+
3638
### πŸ“ Changelog
3739

3840
### πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦ Contributors

β€Ždocs/config.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,7 @@ them
16111611

16121612
Default: `false`
16131613

1614-
Type: `bool` (missing means `false`)
1614+
Type: `flag`
16151615

16161616
### `Routing.LoopbackAddressesOnLanDHT`
16171617

β€Žtest/cli/harness/node.goβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func (n *Node) Init(ipfsArgs ...string) *Node {
208208
cfg.Addresses.Gateway = []string{n.GatewayListenAddr.String()}
209209
cfg.Swarm.DisableNatPortMap = true
210210
cfg.Discovery.MDNS.Enabled = n.EnableMDNS
211-
cfg.Routing.LoopbackAddressesOnLanDHT = true
211+
cfg.Routing.LoopbackAddressesOnLanDHT = config.True
212212
})
213213
return n
214214
}

0 commit comments

Comments
Β (0)