summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/client.go
AgeCommit message (Collapse)Author
2018-11-27simplify client interface (#181)Pablo Mazzini
2018-11-21remove deprecated functions (#182)Pablo Mazzini
2018-11-19dhcpv4: run on unconfigured interfaces (#198)insomniac
2018-11-06[WIP] Added DHCPv4 server (#178)insomniac
* Added DHCPv4 server * Added more modifiers * Fixed some bugs
2018-10-18Make listening port for dhcpv4 client configurable (#179)Gianni Vialetto
2018-10-17Custom client/server addresses/ports for DHCPv4 client (#172)Gianni Vialetto
2018-10-08dhcpv4: fix but in Exchange where a nil packet is returned if send failsAndrea Barberio
2018-10-07DHCPv4: syscall -> x/sys/unixSean Karlage
Fixes #156 Build a simple client like so: ``` package main import ( "fmt" "time" "github.com/insomniacslk/dhcp/dhcpv4" ) func main() { client := dhcpv4.Client{ReadTimeout: 5 * time.Second, WriteTimeout: 5 * time.Second} conversation, err := client.Exchange("en0", nil) if err != nil { fmt.Println(err) } for _, m := range conversation { fmt.Println(m.Summary()) } } ``` and run: ``` $ sudo ./main Password: DHCPv4 opcode=BootRequest hwtype=Ethernet hwaddrlen=6 hopcount=0 transactionid=0xabfad715 numseconds=0 flags=Broadcast (0x8000) clientipaddr=0.0.0.0 youripaddr=0.0.0.0 serveripaddr=0.0.0.0 gatewayipaddr=0.0.0.0 clienthwaddr=8c:85:90:20:2e:33 serverhostname= bootfilename= options= DHCP Message Type -> DISCOVER Parameter Request List -> [Subnet Mask, Router, Domain Name, Domain Name Server] End -> [] DHCPv4 opcode=BootReply hwtype=Ethernet hwaddrlen=6 hopcount=0 transactionid=0xabfad715 numseconds=0 flags=Broadcast (0x8000) clientipaddr=0.0.0.0 youripaddr=192.168.0.105 serveripaddr=0.0.0.0 gatewayipaddr=0.0.0.0 clienthwaddr=8c:85:90:20:2e:33 serverhostname= bootfilename= options= DHCP Message Type -> OFFER Server Identifier -> 192.168.0.1 IP Addresses Lease Time -> 5648 Subnet Mask -> ffffff00 Routers -> 192.168.0.1 Domain Name Servers -> 8.8.8.8, 8.8.4.4 End -> [] DHCPv4 opcode=BootRequest hwtype=Ethernet hwaddrlen=6 hopcount=0 transactionid=0xabfad715 numseconds=0 flags=Broadcast (0x8000) clientipaddr=0.0.0.0 youripaddr=0.0.0.0 serveripaddr=192.168.0.1 gatewayipaddr=0.0.0.0 clienthwaddr=8c:85:90:20:2e:33 serverhostname= bootfilename= options= DHCP Message Type -> REQUEST Requested IP Address -> 192.168.0.105 Server Identifier -> 192.168.0.1 End -> [] DHCPv4 opcode=BootReply hwtype=Ethernet hwaddrlen=6 hopcount=0 transactionid=0xabfad715 numseconds=0 flags=Broadcast (0x8000) clientipaddr=0.0.0.0 youripaddr=192.168.0.105 serveripaddr=0.0.0.0 gatewayipaddr=0.0.0.0 clienthwaddr=8c:85:90:20:2e:33 serverhostname= bootfilename= options= DHCP Message Type -> ACK Server Identifier -> 192.168.0.1 IP Addresses Lease Time -> 7200 Subnet Mask -> ffffff00 Routers -> 192.168.0.1 Domain Name Servers -> 8.8.8.8, 8.8.4.4 End -> [] ```
2018-08-10NewRequestFromOffer: update clientPablo Mazzini
2018-08-10NewRequestFromOffer: update clientPablo Mazzini
2018-07-29Add modifier support to NewReplyFromRequestOwen Mooney
2018-07-29Add support for modifiers to dhcpv4Owen Mooney
2018-07-27[DHCPv4] BroadcastSendReceive now can wait for specific reply types (#95)insomniac
2018-04-18Fixed DHCPv4 listener (#37)insomniac
Fixed DHCPv4 listener There were two bugs in the DHCPv4 client: * the listener was called *after* the sender * the listener was not binding to the same interface as the sender, but listening for every UDP packet This is now fixed.
2018-03-10dhcpv4: fix client regressionAndrea Barberio
2018-03-10Move Exchange back to method on client, rebaseSean Karlage
2018-03-10Refactor client code, add timeout capabilitiesSean Karlage
2018-03-05Move bsdp functionality to its own subpackage. Bring in ↵Sean Karlage
stretchr/testify/assert for nicer asserts
2018-03-03Add BSDP supportSean Karlage
Adds support for constructing INFORM/ACK messages from Apple's Boot Service Discovery Protocol for netbooting (pxebooting) Apple hardware. The canonical reference for BSDP is: http://opensource.apple.com/source/bootp/bootp-198.1/Documentation/BSDP.doc
2018-02-07Added OS-specific implementations for binding to a network deviceAndrea Barberio
2018-02-02Changed API from NewDiscovery to NewDiscoveryForInterfaceAndrea Barberio
2017-12-07Fixed dhcpv4.Exchange interfaceAndrea Barberio
2017-12-05Initial commitAndrea Barberio