Make it possible to use systemd activation for UDP sockets as well.

Refactor the wrapping of sockets into a separate function. For every
fd, try it as a packet socket first. If it errors out, try net.Listener.