Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PacketConn interface #79

Open
kayabe opened this issue Aug 24, 2021 · 6 comments
Open

PacketConn interface #79

kayabe opened this issue Aug 24, 2021 · 6 comments

Comments

@kayabe
Copy link

kayabe commented Aug 24, 2021

is it possible to add support for the udp net.PacketConn interface?

@pires
Copy link
Owner

pires commented Aug 24, 2021

I'm not familiar with that API type. What is your use case?

@kayabe
Copy link
Author

kayabe commented Aug 24, 2021

a server that uses udp protocol

@pires
Copy link
Owner

pires commented Aug 24, 2021

UDP is already supported but this project could use some tests and/or examples doing UDP as well.

@kayabe
Copy link
Author

kayabe commented Aug 24, 2021

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))

@pires
Copy link
Owner

pires commented Aug 26, 2021

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.

@shyam334
Copy link

Have a need to use it in a UDP server. Would be great to have support for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants