mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #1005] Resolver & Client: allow to set bind address or other socket options #587
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#587
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zh-jq on GitHub (Feb 1, 2020).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1005
It will be good to bind socket to specific ip address on machines with many ip addresses (may in different ISP) before connect/send to upstream. And it will be useful to be able to set SO_MARK while working with nftable rules.
There is from_std method for tokio UdpSocket and TcpStream which allow us to setup more options. Will it possible for resolver/client to accept functions generate std UdpSocket and TcpStream which can be used by (tokio) from_std?
@bluejekyll commented on GitHub (Feb 1, 2020):
This is something that I've wanted to do in the library for quite a while. There are a few options here. One would be to add some ResolverOpts for the SO_MARK, and then maybe add a field to
NameServerto express which outbound interface to use, and allow that to be specified on a per NameServer basis. I kinda would prefer that.The other option would be for you to override the
ConnectionProviderinterface and provide a custom implementation, and that could be done without upstream changes. You may want to look at thesocket2crate which has a lot of additional methods for configuring sockets. Also, it would be good to make sure that thebindmethod from Tokio is used, as that is properly Async, which would be better than blocking on bind from a std socket.