| 1 |
# DHCPv6 packet crafting |
| 2 |
|
| 3 |
It is easy to parse, create and manipulate DHCPv6 packets. The `DHCPv6` |
| 4 |
interface is the central way to move packets around. Two concrete |
| 5 |
implementations, `DHCPv6Message` and `DHCPv6Relay` take care of the |
| 6 |
details. The example in [main.go](./main.go) shows how to craft a DHCP6 |
| 7 |
Solicit message with a custom DUID_LLT, encapsulate it in a Relay message, |
| 8 |
and print its details. |
| 9 |
|
| 10 |
|
| 11 |
The output (slightly modified for readability) is |
| 12 |
``` |
| 13 |
$ go run main.go |
| 14 |
2018/11/08 13:56:31 DHCPv6Relay |
| 15 |
messageType=RELAY-FORW |
| 16 |
hopcount=0 |
| 17 |
linkaddr=2001:db8::1 |
| 18 |
peeraddr=2001:db8::2 |
| 19 |
options=[OptRelayMsg{relaymsg=DHCPv6Message(messageType=SOLICIT transactionID=0x9e0242, 4 options)}] |
| 20 |
|
| 21 |
2018/11/08 13:56:31 [12 0 32 1 13 184 0 0 0 0 0 0 0 0 0 0 0 1 32 1 13 184 |
| 22 |
0 0 0 0 0 0 0 0 0 0 0 2 0 9 0 52 1 158 2 66 0 1 0 14 |
| 23 |
0 1 0 1 35 118 253 15 0 250 206 176 12 0 0 6 0 4 0 23 |
| 24 |
0 24 0 8 0 2 0 0 0 3 0 12 250 206 176 12 0 0 14 16 0 |
| 25 |
0 21 24] |
| 26 |
``` |