add an Addr method to the Server

This commit is contained in:
Marten Seemann
2017-02-13 22:33:35 +07:00
parent c533a9adb8
commit ca863a86bb
2 changed files with 13 additions and 0 deletions

View File

@@ -127,6 +127,11 @@ func (s *Server) Close() error {
return conn.Close()
}
// Addr returns the server's network address
func (s *Server) Addr() net.Addr {
return s.addr
}
func (s *Server) handlePacket(conn *net.UDPConn, remoteAddr *net.UDPAddr, packet []byte) error {
if protocol.ByteCount(len(packet)) > protocol.MaxPacketSize {
return qerr.PacketTooLarge