diff --git a/pkg/tcpip/tcpip.go b/pkg/tcpip/tcpip.go index 09be47c0e..082c4c49a 100644 --- a/pkg/tcpip/tcpip.go +++ b/pkg/tcpip/tcpip.go @@ -326,6 +326,12 @@ func (m AddressMask) String() string { return fmt.Sprintf("%x", m.mask) } +// AsSlice returns a as a byte slice. Callers should be careful as it can +// return a window into existing memory. +func (m *AddressMask) AsSlice() []byte { + return []byte(m.mask) +} + // BitLen returns the length of the mask in bits. func (m AddressMask) BitLen() int { return len(m.mask) * 8