fix: default CLI to IPv6 dual-stack, add --ipv4-only flag#43
Conversation
ant-cli built its CoreNodeConfig with ipv6(false), making the client IPv4-only even though ant-core and ant-node default to dual-stack. Align ant-cli with the rest of the stack and expose --ipv4-only for hosts without working IPv6, matching the ant-node flag of the same name.
|
Small, well-scoped fix. Flips CLI default from IPv4-only to dual-stack (matching What I'd want before merging
P2 — polish
Low risk otherwise. LGTM after (1) + (2). |
- CHANGELOG: note the IPv4-only to IPv6 dual-stack default change and the --ipv4-only mitigation for hosts without a working IPv6 stack. - ant-core::Network::new now takes an `ipv6: bool` arg so library callers (ant-gui, future embedders) have the same knob as the CLI. Defaults to `true` via ClientConfig::default(), matching the CLI's new default. - ClientConfig grows an `ipv6` field; Client::connect threads it through to Network::new. - tests/support/mod.rs: add a comment explaining the intentional .ipv6(false) for loopback-only testnets. - network.rs: tighten the doc comment so it no longer claims the direct CoreNodeConfig built in ant-cli is "equivalent" to Network::new when --ipv4-only flips the ipv6 flag. Signed-off-by: grumbach <anselmega@gmail.com>
|
Thanks @Nic-dorman. Addressed the review in b12095d:
Skipped the |
Nic-dorman
left a comment
There was a problem hiding this comment.
macOS CI failure is due to failing to get enough quotes, not related to the PR
Summary
ant-cliwas buildingCoreNodeConfigwithipv6(false), so the client was IPv4-only regardless of host capability — inconsistent withant-core(ipv6(true)) andant-node(dual-stack by default).ant-clito dual-stack and expose--ipv4-onlyfor hosts without working IPv6, mirroringant-node's flag of the same name.ant-core/src/data/network.rsthat claimedant-clibuilt the same config.ant-core::Network::newnow takes anipv6: boolandClientConfighas anipv6field (defaulttrue), so embedders ofant-corecan pick IPv4-only without touchingCoreNodeConfigdirectly.Behavior change (please read before upgrading)
This PR changes the CLI's default network binding from IPv4-only to IPv6 dual-stack. On hosts with a working IPv6 stack this is a straight improvement. On hosts with no IPv6 interface, or IPv6 present but broken, the client will advertise unreachable v6 addresses to the DHT, which causes slow connects and junk address records. The mitigation is the new
--ipv4-onlyflag — pass it and the client behaves exactly as it did before this PR. The same knob is available to library callers asClientConfig { ipv6: false, .. }.Test plan
cargo fmt --allcargo clippy --all-targets --all-features -- -D warnings(clean)ant --helpshows--ipv4-onlywith dual-stack as the defaultcargo test -p ant-core --test e2e_chunk test_chunk_put_get_round_trippasses on macOS against a local loopback testnet (IPv4-only path, exercised viaMiniTestnet). Unit test suite (cargo test -p ant-core --lib) also passes, 135/135.