UDP-lite in Go without raw socket


(Pete Heist) #1

With C in Linux, it’s possible to create a UDP-lite socket simply by specifying IPPROTO_UDPLITE for the third argument to the socket function, i.e.:

fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDPLITE);

but it appears there’s no way to do this with the standard net package in Go as the value of 0 is passed in to the internetSocket function in udpsock_posix.go.

Short of a patch for accepting a new “network” argument “udplite”, which I suspect is not likely to be accepted, it looks like the only way to do UDP-lite in Go is with an IP socket (ListenIP/DialIP), which requires either root privileges or setcap cap_net_raw+ep executable.

Is there any other way to do UDP-lite in Go?