Allow for UDP servers (#935)

* Allow for UDP servers

Extend the Server interface with ServePacket and ListenPacket - this is
in the same vein as the net package.

Plumb the packetconn through the start and restart phases.

Rename RestartPair to RestartTriple as it now also contains a Packet.
Not that these can now be nil, so we need to check for that when
restarting.

* Update the documentation
This commit is contained in:
Miek Gieben
2016-07-18 21:24:09 +01:00
committed by Matt Holt
parent 502a8979a8
commit 9315738dab
3 changed files with 98 additions and 44 deletions

View File

@ -82,10 +82,11 @@ func ValidDirectives(serverType string) []string {
return stype.Directives
}
// serverListener pairs a server to its listener.
// serverListener pairs a server to its listener and/or packetconn.
type serverListener struct {
server Server
listener net.Listener
packet net.PacketConn
}
// Context is a type which carries a server type through