| 1 |
// Copyright 2021 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package netip |
| 6 |
|
| 7 |
import "unique" |
| 8 |
|
| 9 |
var ( |
| 10 |
Z0 = z0 |
| 11 |
Z4 = z4 |
| 12 |
Z6noz = z6noz |
| 13 |
) |
| 14 |
|
| 15 |
type Uint128 = uint128 |
| 16 |
|
| 17 |
type AddrDetail = addrDetail |
| 18 |
|
| 19 |
func MakeAddrDetail(isV6 bool, zoneV6 string) AddrDetail { |
| 20 |
return AddrDetail{isV6: isV6, zoneV6: zoneV6} |
| 21 |
} |
| 22 |
|
| 23 |
func Mk128(hi, lo uint64) Uint128 { |
| 24 |
return uint128{hi, lo} |
| 25 |
} |
| 26 |
|
| 27 |
func MkAddr(u Uint128, z unique.Handle[AddrDetail]) Addr { |
| 28 |
return Addr{u, z} |
| 29 |
} |
| 30 |
|
| 31 |
func IPv4(a, b, c, d uint8) Addr { return AddrFrom4([4]byte{a, b, c, d}) } |
| 32 |
|
| 33 |
var TestAppendToMarshal = testAppendToMarshal |
| 34 |
|
| 35 |
func (a Addr) IsZero() bool { return a.isZero() } |
| 36 |
func (p Prefix) IsZero() bool { return p.isZero() } |