Add query_interface configuration for binding IP queries to specific network interfaces#302
Draft
Add query_interface configuration for binding IP queries to specific network interfaces#302
Conversation
…ork interfaces Co-authored-by: TimothyYe <860685+TimothyYe@users.noreply.github.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.
Users with multiple WAN connections need to query their public IP through a specific interface, particularly when default routes go through CGNAT while backup routes have public IPs.
Changes
Configuration: Added
query_interfacefield toSettingsstruct for specifying which network interface to bind IP queries toNetwork binding: Modified
getIPOnline()to bind HTTP dialer to local address on specified interface:net.InterfaceByName()net.Dialer.LocalAddrto bind TCP connection to that interfaceDocumentation: Added section explaining
query_interfacevsip_interfacedistinction with dual-WAN exampleUsage
{ "ip_urls": ["https://api.ipify.org/"], "query_interface": "wan0", "ip_type": "IPv4" }When set, GoDNS queries public IP through the specified interface rather than default route, ensuring the returned IP reflects the actual reachable address.
Note:
query_interfacebinds the HTTP request to an interface, whileip_interfacereads IP directly from local interface without external requests.Original prompt