-
Notifications
You must be signed in to change notification settings - Fork 187
Open
Description
I'm working on writing a DHCP server. I recognize that on Windows this library won't bind to a specific network interface, so I tried this approach. I am able to successfully bind the UDP listener to the specific IP address which is assigned to a specific network interface, but I'm not seeing any logs indicating that packets are received.
conn, err := net.ListenUDP("udp4", &net.UDPAddr{
IP: net.ParseIP("10.0.0.253"),
Port: dhcpv4.ServerPort,
})
require.NoError(t, err)
srv, err := server4.NewServer("Ethernet 2", nil, func(conn net.PacketConn, peer net.Addr, pkt *dhcpv4.DHCPv4) {
fmt.Println("Received packet:", pkt.Summary())
}, server4.WithConn(conn))
require.NoError(t, err)
require.NoError(t, srv.Serve())When I run this on macOS instead, it works just fine. Has anyone got this working on Windows before?
srv, err := server4.NewServer("Ethernet 2", &net.UDPAddr{
IP: net.ParseIP(":0"),
Port: dhcpv4.ServerPort,
}, func(conn net.PacketConn, peer net.Addr, pkt *dhcpv4.DHCPv4) {
fmt.Println("Received packet:", pkt.Summary())
})
require.NoError(t, err)
require.NoError(t, srv.Serve())Metadata
Metadata
Assignees
Labels
No labels