summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--dhcpv6/dhcpv6message.go10
-rw-r--r--dhcpv6/dhcpv6relay.go7
-rw-r--r--examples/everythingmessage/main.go2
3 files changed, 9 insertions, 10 deletions
diff --git a/dhcpv6/dhcpv6message.go b/dhcpv6/dhcpv6message.go
index e2210fd..e68284f 100644
--- a/dhcpv6/dhcpv6message.go
+++ b/dhcpv6/dhcpv6message.go
@@ -202,8 +202,8 @@ func (mo MessageOptions) UserClasses() [][]byte {
//
// RFC 8415 Section 21.17:
//
-// Multiple instances of the Vendor-specific Information option may appear in
-// a DHCP message.
+// Multiple instances of the Vendor-specific Information option may appear in
+// a DHCP message.
func (mo MessageOptions) VendorOpts() []*OptVendorOpts {
opt := mo.Options.Get(OptionVendorOpts)
if opt == nil {
@@ -222,8 +222,8 @@ func (mo MessageOptions) VendorOpts() []*OptVendorOpts {
//
// RFC 8415 Section 21.17:
//
-// Servers and clients MUST NOT send more than one instance of the
-// Vendor-specific Information option with the same Enterprise Number.
+// Servers and clients MUST NOT send more than one instance of the
+// Vendor-specific Information option with the same Enterprise Number.
func (mo MessageOptions) VendorOpt(enterpriseNumber uint32) Options {
vo := mo.VendorOpts()
for _, v := range vo {
@@ -543,7 +543,7 @@ func (m *Message) IsOptionRequested(requested OptionCode) bool {
// String returns a short human-readable string for this message.
func (m *Message) String() string {
- return fmt.Sprintf("Message(messageType=%s transactionID=%s, %d options)",
+ return fmt.Sprintf("Message(MessageType=%s, TransactionID=%#x, %d options)",
m.MessageType, m.TransactionID, len(m.Options.Options))
}
diff --git a/dhcpv6/dhcpv6relay.go b/dhcpv6/dhcpv6relay.go
index 6245b81..ace35f7 100644
--- a/dhcpv6/dhcpv6relay.go
+++ b/dhcpv6/dhcpv6relay.go
@@ -94,11 +94,8 @@ func (r *RelayMessage) Type() MessageType {
// String prints a short human-readable relay message.
func (r *RelayMessage) String() string {
- ret := fmt.Sprintf(
- "RelayMessage(messageType=%s hopcount=%d, linkaddr=%s, peeraddr=%s, %d options)",
- r.Type(), r.HopCount, r.LinkAddr, r.PeerAddr, len(r.Options.Options),
- )
- return ret
+ return fmt.Sprintf("RelayMessage(MessageType=%s, HopCount=%d, LinkAddr=%s, PeerAddr=%s, %d options)",
+ r.Type(), r.HopCount, r.LinkAddr, r.PeerAddr, len(r.Options.Options))
}
// Summary prints all options associated with this relay message.
diff --git a/examples/everythingmessage/main.go b/examples/everythingmessage/main.go
index 38855dd..4c68a72 100644
--- a/examples/everythingmessage/main.go
+++ b/examples/everythingmessage/main.go
@@ -81,6 +81,7 @@ func main() {
dhcpv6.WithOption(&dhcpv6.OptVendorClass{EnterpriseNumber: 300, Data: [][]byte{[]byte("foo"), []byte("bar")}}),
dhcpv6.WithOption(vendorOpts),
)
+ fmt.Println(adv.String())
fmt.Println(adv.Summary())
relayfw := dhcpv6.RelayMessage{
@@ -91,5 +92,6 @@ func main() {
EnterpriseNumber: 0x123,
RemoteID: []byte{0x1, 0x2},
})
+ fmt.Println(relayfw.String())
fmt.Println(relayfw.Summary())
}