()
| 42 | ) |
| 43 | |
| 44 | func (mt MessageType) String() string { |
| 45 | switch mt { |
| 46 | case MsgDiscover: |
| 47 | return "DHCPDISCOVER" |
| 48 | case MsgOffer: |
| 49 | return "DHCPOFFER" |
| 50 | case MsgRequest: |
| 51 | return "DHCPREQUEST" |
| 52 | case MsgDecline: |
| 53 | return "DHCPDECLINE" |
| 54 | case MsgAck: |
| 55 | return "DHCPACK" |
| 56 | case MsgNack: |
| 57 | return "DHCPNAK" |
| 58 | case MsgRelease: |
| 59 | return "DHCPRELEASE" |
| 60 | case MsgInform: |
| 61 | return "DHCPINFORM" |
| 62 | default: |
| 63 | return fmt.Sprintf("<unknown DHCP message type %d>", mt) |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | // Packet represents a DHCP packet. |
| 68 | type Packet struct { |