summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6
diff options
context:
space:
mode:
authorAndrea Barberio <insomniac@slackware.it>2019-01-28 10:47:25 +0000
committerinsomniac <insomniacslk@users.noreply.github.com>2019-01-28 11:21:18 +0000
commit89df4777a1687cf4d796afc91b30fa0beee7506d (patch)
tree43976d43185df5bf610104c2f1466e309dcb28e0 /dhcpv6
parent51ac989e85d13beda9cb304fb85e0aff18e9cd98 (diff)
Created examples directory and adjusted README
Diffstat (limited to 'dhcpv6')
-rw-r--r--dhcpv6/server6/server.go46
1 files changed, 0 insertions, 46 deletions
diff --git a/dhcpv6/server6/server.go b/dhcpv6/server6/server.go
index 5c84f97..6a6d0b7 100644
--- a/dhcpv6/server6/server.go
+++ b/dhcpv6/server6/server.go
@@ -10,52 +10,6 @@ import (
"github.com/insomniacslk/dhcp/dhcpv6"
)
-/*
- To use the DHCPv6 server code you have to call NewServer with two arguments:
- - a handler function, that will be called every time a valid DHCPv6 packet is
- received, and
- - an address to listen on.
-
- The handler is a function that takes as input a packet connection, that can be
- used to reply to the client; a peer address, that identifies the client sending
- the request, and the DHCPv6 packet itself. Just implement your custom logic in
- the handler.
-
- The address to listen on is used to know IP address, port and optionally the
- scope to create and UDP6 socket to listen on for DHCPv6 traffic.
-
- Example program:
-
-
-package main
-
-import (
- "log"
- "net"
-
- "github.com/insomniacslk/dhcp/dhcpv6"
-)
-
-func handler(conn net.PacketConn, peer net.Addr, m dhcpv6.DHCPv6) {
- // this function will just print the received DHCPv6 message, without replying
- log.Print(m.Summary())
-}
-
-func main() {
- laddr := net.UDPAddr{
- IP: net.ParseIP("::1"),
- Port: dhcpv6.DefaultServerPort,
- }
- server := dhcpv6.NewServer(laddr, handler)
-
- defer server.Close()
- if err := server.ActivateAndServe(); err != nil {
- log.Panic(err)
- }
-}
-
-*/
-
// 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.DHCPv6)