You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on connection reuse in dns_exporter. I want to open a socket to, say, a DoT server and use it for many lookups without having to do the whole TCP+TLS handshake for every query. dnspython supports this by providing a socket to for example dns.query.tls() in the sock argument. To create that socket currently I have to import and copy a bunch of the socket creation logic from dnspython to dns_exporter.
I would help a lot if the socket creation code in the query functions could be refactored into seperate functions, maybe dns.query.tls() could call dns.query.get_tls_socket() when the sock argument is not provided, but then dns.query.get_tls_socket() could also be called by the implementer for connection reuse purposes. This would make it trivial to use dnspython with, say, a DoT socket doing many lookups but only getting the tcp+tls handshake penalty once.
I am happy to help implement this, but I wanted to gauge your interest before writing too much code. I have a local branch with a working example for DoT, and it isn't that big of a diff, plus it almost makes the code more clean to have the socket creation stuff in a seperate function. Maybe more testable too. Let me know what you think, and if you agree this would be good to have in dnspython then please let me know how you wish to proceed regarding implementation details, who does what, etc.
Context (please complete the following information):
dnspython 2.7.0
Python 3.12
OS: debian
The text was updated successfully, but these errors were encountered:
It occurred to me that connection reuse could also be something entirely handled by dnspython, instead of by consumers of dnspython. I would be totally fine with doing it externally, I just wanted to mention it.
I am working on connection reuse in dns_exporter. I want to open a socket to, say, a DoT server and use it for many lookups without having to do the whole TCP+TLS handshake for every query. dnspython supports this by providing a socket to for example
dns.query.tls()
in thesock
argument. To create that socket currently I have to import and copy a bunch of the socket creation logic from dnspython to dns_exporter.I would help a lot if the socket creation code in the query functions could be refactored into seperate functions, maybe
dns.query.tls()
could calldns.query.get_tls_socket()
when thesock
argument is not provided, but thendns.query.get_tls_socket()
could also be called by the implementer for connection reuse purposes. This would make it trivial to use dnspython with, say, a DoT socket doing many lookups but only getting the tcp+tls handshake penalty once.I am happy to help implement this, but I wanted to gauge your interest before writing too much code. I have a local branch with a working example for DoT, and it isn't that big of a diff, plus it almost makes the code more clean to have the socket creation stuff in a seperate function. Maybe more testable too. Let me know what you think, and if you agree this would be good to have in dnspython then please let me know how you wish to proceed regarding implementation details, who does what, etc.
Context (please complete the following information):
The text was updated successfully, but these errors were encountered: