summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/packetcrafting6/main.go7
-rw-r--r--examples/server6/main.go12
-rwxr-xr-xexamples/server6/server6bin2842321 -> 0 bytes
3 files changed, 12 insertions, 7 deletions
diff --git a/examples/packetcrafting6/main.go b/examples/packetcrafting6/main.go
index 7e2fb1b..f2c1855 100644
--- a/examples/packetcrafting6/main.go
+++ b/examples/packetcrafting6/main.go
@@ -15,9 +15,14 @@ func main() {
// that implement the `dhcpv6.DHCPv6` interface.
// Then print the wire-format representation of the packet.
+ iface, err := net.InterfaceByName("eth0")
+ if err != nil {
+ log.Fatal(err)
+ }
+
// Create the DHCPv6 Solicit first, using the interface "eth0"
// to get the MAC address
- msg, err := dhcpv6.NewSolicitForInterface("eth0")
+ msg, err := dhcpv6.NewSolicit(iface.HardwareAddr)
if err != nil {
log.Fatal(err)
}
diff --git a/examples/server6/main.go b/examples/server6/main.go
index 174f798..318937f 100644
--- a/examples/server6/main.go
+++ b/examples/server6/main.go
@@ -14,14 +14,14 @@ func handler(conn net.PacketConn, peer net.Addr, m dhcpv6.DHCPv6) {
}
func main() {
- laddr := net.UDPAddr{
+ laddr := &net.UDPAddr{
IP: net.ParseIP("::1"),
Port: dhcpv6.DefaultServerPort,
}
- server := server6.NewServer(laddr, handler)
-
- defer server.Close()
- if err := server.ActivateAndServe(); err != nil {
- log.Panic(err)
+ server, err := server6.NewServer(laddr, handler)
+ if err != nil {
+ log.Fatal(err)
}
+
+ server.Serve()
}
diff --git a/examples/server6/server6 b/examples/server6/server6
deleted file mode 100755
index 16f6153..0000000
--- a/examples/server6/server6
+++ /dev/null
Binary files differ