summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@google.com>2019-08-14 15:00:58 -0700
committergVisor bot <gvisor-bot@google.com>2019-08-14 15:02:14 -0700
commit69d1414a322dd2ad9b669bceaf59617b333e424a (patch)
tree1ce4a4309f8e3014bdeed73f7d944751919975a6 /pkg/tcpip
parent570fb1db6b4e01be37386a379fea4d63e5a3cdc2 (diff)
Add tcpip.AddressWithPrefix.String
PiperOrigin-RevId: 263436592
Diffstat (limited to 'pkg/tcpip')
-rw-r--r--pkg/tcpip/tcpip.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/tcpip/tcpip.go b/pkg/tcpip/tcpip.go
index 119712d2f..db6d5a9bf 100644
--- a/pkg/tcpip/tcpip.go
+++ b/pkg/tcpip/tcpip.go
@@ -1072,6 +1072,11 @@ type AddressWithPrefix struct {
PrefixLen int
}
+// String implements the fmt.Stringer interface.
+func (a AddressWithPrefix) String() string {
+ return fmt.Sprintf("%s/%d", a.Address, a.PrefixLen)
+}
+
// ProtocolAddress is an address and the network protocol it is associated
// with.
type ProtocolAddress struct {