go-proxyproto
go-proxyproto copied to clipboard
PacketConn interface
is it possible to add support for the udp net.PacketConn interface?
I'm not familiar with that API type. What is your use case?
a server that uses udp protocol
UDP is already supported but this project could use some tests and/or examples doing UDP as well.
using proxyproto.NewConn doesnt let me convert the proxyproto.Conn to net.PacketConn
func(c net.PacketConn) net.PacketConn {
e := c.(net.Conn)
d := proxyproto.NewConn(e)
return d
}
errors:
cannot use d (variable of type *proxyproto.Conn) as net.PacketConn value in return statement: wrong type for method ReadFrom (have func(r io.Reader) (int64, error), want func(p []byte) (n int, addr net.Addr, err error))
This library supports your use-case already, just not through the API type. I don't plan to work on this, I'm sorry. But I'll keep it open so that maybe someone shares the same need and we learn about it. Or maybe someone submits a patch.
Have a need to use it in a UDP server. Would be great to have support for this.