github.com/database64128/shadowsocks-go@v1.10.2-0.20240315062903-143a773533f1/conn/conn_mmsg.go (about) 1 //go:build linux || netbsd 2 3 package conn 4 5 import ( 6 "context" 7 "net" 8 ) 9 10 // ListenUDPRawConn is like [ListenUDP] but wraps the [*net.UDPConn] in a [rawUDPConn] for batch I/O. 11 func (lc *ListenConfig) ListenUDPRawConn(ctx context.Context, network, address string) (rawUDPConn, error) { 12 pc, err := lc.ListenConfig.ListenPacket(ctx, network, address) 13 if err != nil { 14 return rawUDPConn{}, err 15 } 16 return NewRawUDPConn(pc.(*net.UDPConn)) 17 }