I guess thats still kind of confusing without making something more clear...
In my example, both myprotocol.example.com and test.example.com DNS records would point to the same IP address. One nginx instance then listens on that IP and serves up several ssl apps. They go through a "mapper" that uses the SNI and the ssl_preread directive to read the destination hostname of the packet to determine which app to route the traffic to.
I just want transport.write() to not resolve the ip address of the host I pass in. Everything will work if it connects and sends packets to myprotocol.example.com:443 instead of 220.127.116.11:443.
Nginx reference: http://nginx.org/en/docs/stream/ngx_stream_ssl_preread_module.html
On Thu, Aug 16, 2018 at 6:14 PM, Sean DiZazzo email@example.com wrote:
Thanks for responding, Adi!
I don't want each packet to go it's own way from Twisted. They all go to the same place from each instance of the server/protocol. They go to my custom protocol listening on another local port.
It's just that I'm serving up several different ssl apps on the same nginx server, and nginx uses the hostname to route the packets. So in this case, traffic coming in on http.example.com:443 might be routed to an https app listening on a socket, and traffic coming in to myprotocol.example.com:443 should be routed to my own protocol listening on port 9999. So if nginx doesn't get the hostname, it doesn't know to route the packet to my custom protocol instead of the web server. Does that make sense?
It seems that the transport is resolving the hostname to an ip address and then sending the traffic to the generic ip which is not enough info for nginx to route the packet correctly.
On Thu, Aug 16, 2018 at 5:49 PM, Adi Roiban firstname.lastname@example.org wrote:
On Fri, 17 Aug 2018 at 01:25, Sean DiZazzo email@example.com wrote:
After I start a reactor connecting to a specific hostname and port, I
do my thing and then call transport.write() to send the data to the peer.
From what I can tell, though, the hostname is resolved, and the data is
written back to the ip address itself, instead of the hostname I started the reactor with.
This is a problem in my case because we are using nginx's ssl_preread
server_name directive to route several different streams all coming in on the same ip address.
So the write() method needs to explicitly use the hostname to route the
So... Is there any way to have transport.write() use the hostname given
instead of it's resolved IP address? Or am I missing something?
I assume you are using TCP here.
I guess that you are missing something.
If you want each write to go over its own way / route and have the hostname re-resolved you should open + write + close a connection for each write.
But I think that there is something else there and this is now what you want :) Do you use HTTP or have a custom protocol?
Twisted-Python mailing list Twisted-Python@twistedmatrix.com https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python