tcp
tcp copied to clipboard
allow using a wrapped net.TCPConn in NewConn
Currently, the connection passed to NewConn
has to be a *net.TCPConn
, even though the function allows for a net.Conn
to be passed. This is because NewConn
performs a type assertion:
https://github.com/mikioh/tcp/blob/803a9b46060c1d8b9ee03ff0386b87c179f50227/rawconn.go#L99-L112
It would be nice if it was possible to pass a wrapped *net.TCPConn
to NewConn
. This should be a problem, as the only function actually needed is SyscallConn()
. By doing an interface assertion using an interface only fulfilled by a net.TCPConn
, we can even make sure that we don't accidentally use this package with a connection that's not a TCP connection.
@mikioh Any thought about this PR?
@mikioh Friendly ping. It would be really great if we could get this PR merged soon, I'd hate to fork this project for such a minor change.