diff options
author | Andrea Barberio <insomniac@slackware.it> | 2018-09-27 00:09:24 +0100 |
---|---|---|
committer | Andrea Barberio <insomniac@slackware.it> | 2018-09-27 00:09:24 +0100 |
commit | 0845afe72e425c66b9dd591c375e810cfb85de47 (patch) | |
tree | 67508f02cb56b2abe530ba30ee196100490e9286 /dhcpv6/server.go | |
parent | 6f918ae9d99262ce9af6e2a476984c51fac2fc61 (diff) |
linter
Diffstat (limited to 'dhcpv6/server.go')
-rw-r--r-- | dhcpv6/server.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/dhcpv6/server.go b/dhcpv6/server.go index 786d369..b832a8a 100644 --- a/dhcpv6/server.go +++ b/dhcpv6/server.go @@ -51,14 +51,18 @@ func main() { */ +// Handler is a type that defines the handler function to be called every time a +// valid DHCPv6 message is received type Handler func(conn net.PacketConn, peer net.Addr, m DHCPv6) +// Server represents a DHCPv6 server object type Server struct { conn net.PacketConn LocalAddr net.UDPAddr Handler Handler } +// ActivateAndServe starts the DHCPv6 server func (s *Server) ActivateAndServe() error { if s.conn == nil { conn, err := net.ListenUDP("udp6", &s.LocalAddr) @@ -99,6 +103,7 @@ func (s *Server) ActivateAndServe() error { return nil } +// NewServer initializes and returns a new Server object func NewServer(addr net.UDPAddr, handler Handler) *Server { return &Server{ LocalAddr: addr, |