Add bind_address config option for local IP binding#279
Open
kofany wants to merge 1 commit intoaatxe:developfrom
Open
Add bind_address config option for local IP binding#279kofany wants to merge 1 commit intoaatxe:developfrom
kofany wants to merge 1 commit intoaatxe:developfrom
Conversation
Allow clients to bind to a specific local IP address when connecting to an IRC server. This is useful for multi-homed machines, vhosts, or running multiple bots from different IP addresses. - Add `bind_address` field to Config (Option<String>) - Add `bind_address()` getter method - Add `InvalidBindAddress` error variant to ConfigError - Use TcpSocket with bind() in connect_with_bind() helper - Handle IPv4/IPv6 address family matching on DNS resolution - Log warning when bind_address is used with SOCKS5 proxy Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bind_addressconfiguration option that allows clients to bind to a specific local IP address when establishing a connection to an IRC servertokio::net::TcpSocketto bind before connecting, with proper IPv4/IPv6 address family matching during DNS resolutionChanges
src/client/data/config.rs: Newbind_address: Option<String>field with serde support andbind_address()gettersrc/client/conn.rs: Newconnect_with_bind()helper usingTcpSocket::bind()+connect(), integrated into both proxy and non-proxynew_stream()variantssrc/error.rs: NewConfigError::InvalidBindAddressvariant for invalid IP address stringsUsage
TOML config
Programmatic
Notes
bind_addressisNone(default), behavior is unchanged — the OS selects the local addressTcpSocketis already available via tokio'snetfeature)Test plan
cargo check— compiles cleanlycargo clippy --all-targets --all-features— no new warningscargo test— all 67 unit tests + 8 doc-tests pass🤖 Generated with Claude Code