tidwall / evio

Fast event-loop networking for Go
MIT License
5.88k stars 491 forks source link

Serve from a specific net.PacketConn #43

Open ilyaglow opened 5 years ago

ilyaglow commented 5 years ago

Hey there,

What do you think about adding a function that can serve events from a specified net.PacketConn or do you have a will to accept a PR with this feature?

ilyaglow commented 5 years ago

Here is my try: https://github.com/ilyaglow/evio/blob/master/evio.go#L196

ghost commented 5 years ago

https://github.com/tidwall/evio/blob/master/evio.go#L162 ?

ilyaglow commented 5 years ago

The thing is that I need to use my net.PacketConn in multiple places and not stick it for evio only. I have an app that sends a lot of packets through UDP socket and evio simply process replies.

ghost commented 5 years ago

hm, looks like there should be no issue with this. i use the same approach for http/grpc servers where i handle tls on the listener and not in the server, for example. but in this case the serve() method is private so you have to fork it :(