Open dgllghr opened 5 years ago
It's not worth enabling nodelay just for quicker SOCKS negotiation because the effect continues after the negotiation. But it'll be nice to have configurable TCP connections.
I prefer to take an existing TCP connection rather than add configs in this library. I don't want to repeat net2
's work.
Thanks to #20, it's possible to configure the socket ahead of time.
I've noticed that using TCP nodelay allows SOCKS connections to be established more quickly because the SOCKS negotiation includes many small messages. I haven't tested using nodelay with this library in particular, but it would be nice to provide this configuration option so that the caller can determine whether they want to use nodelay.
In general, it might be easier to allow the library consumer to have more control over how the underlying TCP connection is configured. The easiest way to do this would probably be to support a variant of
Socks5Stream::connect
that takes an existing TCP stream so the caller can set up the stream however they want, but this could also be done with specific configuration options.I can set up a PR for any of these options pretty quickly, but I wanted to discuss first.