Skip to content

Use IPv6 loopback [::1]:4002 as default IBKR_ADDR#1

Open
0xpoorman wants to merge 1 commit intomainfrom
codex/build-ibkr-v100+-async-rust-pipeline
Open

Use IPv6 loopback [::1]:4002 as default IBKR_ADDR#1
0xpoorman wants to merge 1 commit intomainfrom
codex/build-ibkr-v100+-async-rust-pipeline

Conversation

@0xpoorman
Copy link
Owner

Motivation

  • Ensure the client can connect when IB Gateway is listening on an IPv6 interface (*:4002) by dialing the IPv6 loopback address.
  • Avoid relying on localhost/127.0.0.1 which may not reach an IPv6-only listener.

Description

  • Change the IBKR_ADDR fallback in src/main.rs to use the IPv6 loopback address "[::1]:4002" instead of "localhost:4002" by updating the environment fallback expression for IBKR_ADDR.

Testing

  • Ran cargo fmt, which completed successfully.
  • No automated unit or integration tests were run against a live IB Gateway in this rollout.

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant