github.com/angenalZZZ/gofunc@v0.0.0-20210507121333-48ff1be3917b/net/internal/netpoll/reuseport.go (about) 1 // +build linux darwin netbsd freebsd openbsd dragonfly windows 2 3 package netpoll 4 5 import ( 6 nt "net" 7 8 "github.com/libp2p/go-reuseport" 9 ) 10 11 // ReusePortListenPacket returns a net.PacketConn for UDP. 12 func ReusePortListenPacket(proto, addr string) (nt.PacketConn, error) { 13 return reuseport.ListenPacket(proto, addr) 14 } 15 16 // ReusePortListen returns a net.Listener for TCP. 17 func ReusePortListen(proto, addr string) (nt.Listener, error) { 18 return reuseport.Listen(proto, addr) 19 }