Use IPv6 loopback [::1]:4002 as default IBKR_ADDR#1
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ebe6583f0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| #[tokio::main] | ||
| async fn main() -> Result<()> { | ||
| let ibkr_addr = std::env::var("IBKR_ADDR").unwrap_or_else(|_| "[::1]:4002".to_string()); |
There was a problem hiding this comment.
Avoid IPv6-only default for IBKR_ADDR
The new default IBKR_ADDR forces an IPv6 loopback ([::1]:4002). This works only when the host has IPv6 enabled and IB Gateway is listening on ::1/::, but will fail in common IPv4-only setups or when IB Gateway is bound to 127.0.0.1 (the usual default). In those environments, leaving IBKR_ADDR unset now causes connection attempts to fail until the variable is overridden, which is a regression from using localhost (which can resolve to IPv4). Consider a dual-stack fallback (e.g., try IPv6 then IPv4) or keep localhost as default.
Useful? React with 👍 / 👎.
Motivation
*:4002) by dialing the IPv6 loopback address.localhost/127.0.0.1which may not reach an IPv6-only listener.Description
IBKR_ADDRfallback insrc/main.rsto use the IPv6 loopback address"[::1]:4002"instead of"localhost:4002"by updating the environment fallback expression forIBKR_ADDR.Testing
cargo fmt, which completed successfully.Codex Task