File: ndptest.go

package info (click to toggle)
golang-github-mdlayher-ndp 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 244 kB
  • sloc: makefile: 3
file content (30 lines) | stat: -rw-r--r-- 649 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Package ndptest provides test functions and types for package ndp.
package ndptest

import (
	"bytes"
	"net"
	"net/netip"
)

// Shared test data for commonly needed data types.
var (
	Prefix = netip.MustParseAddr("2001:db8::")
	IP     = netip.MustParseAddr("2001:db8::1")
	MAC    = net.HardwareAddr{0xde, 0xad, 0xbe, 0xef, 0xde, 0xad}
)

// Merge merges a slice of byte slices into a single, contiguous slice.
func Merge(bs [][]byte) []byte {
	var b []byte
	for _, bb := range bs {
		b = append(b, bb...)
	}

	return b
}

// Zero returns a byte slice of size n filled with zeros.
func Zero(n int) []byte {
	return bytes.Repeat([]byte{0x00}, n)
}