diff options
author | Andrea Barberio <insomniac@slackware.it> | 2017-12-08 23:18:01 +0000 |
---|---|---|
committer | Andrea Barberio <insomniac@slackware.it> | 2017-12-08 23:18:01 +0000 |
commit | 37d15e6162da76cb135ee09475b3f224f2567ca6 (patch) | |
tree | 0194c1b1d73e146da0a1dc01a20dde797da0e1cc | |
parent | dd43439452cc80f2502380364d3b1d9bbd8a5689 (diff) |
Added String() to DHCPv6 interface and implemented in DHCPv6Relay
-rw-r--r-- | dhcpv6/dhcpv6.go | 1 | ||||
-rw-r--r-- | dhcpv6/dhcpv6relay.go | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/dhcpv6/dhcpv6.go b/dhcpv6/dhcpv6.go index 97eb401..9e24322 100644 --- a/dhcpv6/dhcpv6.go +++ b/dhcpv6/dhcpv6.go @@ -7,6 +7,7 @@ import ( type DHCPv6 interface { Type() MessageType ToBytes() []byte + String() string Summary() string Length() int } diff --git a/dhcpv6/dhcpv6relay.go b/dhcpv6/dhcpv6relay.go index 236a23a..4255d02 100644 --- a/dhcpv6/dhcpv6relay.go +++ b/dhcpv6/dhcpv6relay.go @@ -23,6 +23,14 @@ func (r *DHCPv6Relay) MessageTypeToString() string { return MessageTypeToString(r.messageType) } +func (r *DHCPv6Relay) String() string { + ret := fmt.Sprintf( + "DHCPv6Relay(messageType=%v hopcount=%v, linkaddr=%v, peeraddr=%v, %d options)", + r.MessageTypeToString(), r.hopCount, r.linkAddr, r.peerAddr, len(r.options), + ) + return ret +} + func (r *DHCPv6Relay) Summary() string { ret := fmt.Sprintf( "DHCPv6Relay\n"+ |