Skip to content

feat: add option to bind outgoing connections to a specific interface#185

Merged
m13253 merged 2 commits intom13253:masterfrom
shahradelahi:feature/bind-to-interface
Mar 17, 2026
Merged

feat: add option to bind outgoing connections to a specific interface#185
m13253 merged 2 commits intom13253:masterfrom
shahradelahi:feature/bind-to-interface

Conversation

@shahradelahi
Copy link
Contributor

This adds a new interface configuration option to doh-client that allows users to specify a network interface for all outgoing DNS queries (including bootstrap and passthrough traffic).

This adds a new `interface` configuration option to `doh-client` that allows users to specify a network interface for all outgoing DNS queries (including bootstrap and passthrough traffic).
@m13253
Copy link
Owner

m13253 commented Jan 23, 2026

I super love this feature. Please give me some time to review this.

By the way, does it work correctly on dual-stack networks? I remembr Golang’s HTTP client uses Happy Eyeballs algorithm. (I could be wrong.) Is this new function compatible with it?

@shahradelahi
Copy link
Contributor Author

I totally forgot about that. You're right, binding to a specific local IP breaks the default Happy Eyeballs behavior. I'll update the PR with a custom DialContext to handle dual-stack properly.

@m13253
Copy link
Owner

m13253 commented Jan 26, 2026

@vinnyperella Sorry to disturb you.
Do you have access to any environment with multiple network cards + IPv4/IPv6 dual stack + an (iptables) firewall that can intermittently drop IPv4/IPv6 packets to test this new feature?
I appreciate it very much!

I am considering to combining this new feature along #186 in the upcoming release but I currently don’t have enough time to test it throughoutly to make sure it doesn’t break anyone’s setup.

@vinnyperella
Copy link
Contributor

@vinnyperella Sorry to disturb you. Do you have access to any environment with multiple network cards + IPv4/IPv6 dual stack + an (iptables) firewall that can intermittently drop IPv4/IPv6 packets to test this new feature? I appreciate it very much!

I am considering to combining this new feature along #186 in the upcoming release but I currently don’t have enough time to test it throughoutly to make sure it doesn’t break anyone’s setup.

@m13253 no worries but unfortunately I do not have a machine with multiple NIC's but I can see if I can aquire one I'd be more than happy to test.

@m13253
Copy link
Owner

m13253 commented Jan 26, 2026

@vinnyperella Sorry to disturb you. Do you have access to any environment with multiple network cards + IPv4/IPv6 dual stack + an (iptables) firewall that can intermittently drop IPv4/IPv6 packets to test this new feature? I appreciate it very much!

I am considering to combining this new feature along #186 in the upcoming release but I currently don’t have enough time to test it throughoutly to make sure it doesn’t break anyone’s setup.

@m13253 no worries but unfortunately I do not have a machine with multiple NIC's but I can see if I can aquire one I'd be more than happy to test.

If we consider lo as another NIC then probably we can test it against lo.

@vinnyperella
Copy link
Contributor

@vinnyperella Sorry to disturb you. Do you have access to any environment with multiple network cards + IPv4/IPv6 dual stack + an (iptables) firewall that can intermittently drop IPv4/IPv6 packets to test this new feature? I appreciate it very much!

I am considering to combining this new feature along #186 in the upcoming release but I currently don’t have enough time to test it throughoutly to make sure it doesn’t break anyone’s setup.

@m13253 no worries but unfortunately I do not have a machine with multiple NIC's but I can see if I can aquire one I'd be more than happy to test.

If we consider lo as another NIC then probably we can test it against lo.

Well in that case yes I can test it I thought you meant an additional hardware NIC I'll try and get it set up in the next day or so.

@m13253
Copy link
Owner

m13253 commented Mar 16, 2026

I plan to merge this soon. Does anyone else have issues with the PR?

@vinnyperella
Copy link
Contributor

Sorry I have been quite busy lately I've been testing this for over a month and I've not run into any issues.

@m13253
Copy link
Owner

m13253 commented Mar 17, 2026

Sorry I have been quite busy lately I've been testing this for over a month and I've not run into any issues.

Sorry, I have also been very busy. I don’t seem to have issues with the change either.

@m13253 m13253 merged commit 82c5f0d into m13253:master Mar 17, 2026
1 check passed
@m13253
Copy link
Owner

m13253 commented Mar 17, 2026

Our codebase finally gets a new feature!

@satishweb
Copy link
Collaborator

Are we doing a new release?

@m13253
Copy link
Owner

m13253 commented Mar 17, 2026

Yes. But I want us to wait for a few days to give chance for the public to submit bug reports.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants