d2g / dhcp4client

DHCP Client
Mozilla Public License 2.0
38 stars 30 forks source link

implement unicast for DHCP renew #15

Closed bohdantrotsenko closed 5 years ago

bohdantrotsenko commented 6 years ago

This change is dictated by the need to send renew requests via unicast. That breaks the beauty of interfaces and inetsock.

d2g commented 6 years ago

If we're going to change it it probably makes sense to move towards the net.Conn[https://golang.org/pkg/net/#Conn] interface. Then hold 2 connections (Broadcast & Unicast).

Do you have any thoughts/opinions on that?

bohdantrotsenko commented 6 years ago

There is an issue with this abstraction. At renew stage I want the dhcp client to use unicast. The current abstraction, Write([]byte) doesn't include the broadcast/unicast option, therefore I have updated the signature (by the way, I could use a different name for that, e.g. WriteUnicast([]byte, net.IP, net.IP)

Therefore, the net.Conn, which here should serve both for a) broadcasting b) unicasting, as I see it, doesn't fit.

d2g commented 5 years ago

This should now be implemented in the v2 branch. Let me know if you see any issues.