Documentation ¶
Index ¶
- Variables
- func CheckIPv6Subnet(subnetIP *IP6, mask *big.Int) bool
- func DirectRouting(ip net.IP) (bool, error)
- func EnsureV4AddressOnLink(ipa IP4Net, ipn IP4Net, link netlink.Link) error
- func EnsureV6AddressOnLink(ipa IP6Net, ipn IP6Net, link netlink.Link) error
- func GetDefaultGatewayInterface() (*net.Interface, error)
- func GetDefaultV6GatewayInterface() (*net.Interface, error)
- func GetInterfaceByIP(ip net.IP) (*net.Interface, error)
- func GetInterfaceByIP6(ip net.IP) (*net.Interface, error)
- func GetInterfaceBySpecificIPRouting(ip net.IP) (*net.Interface, net.IP, error)
- func GetInterfaceIP4AddrMatch(iface *net.Interface, matchAddr net.IP) error
- func GetInterfaceIP4Addrs(iface *net.Interface) ([]net.IP, error)
- func GetInterfaceIP6AddrMatch(iface *net.Interface, matchAddr net.IP) error
- func GetInterfaceIP6Addrs(iface *net.Interface) ([]net.IP, error)
- func IsEmpty(subnet *IP6) bool
- func MapIP4ToString(nws []IP4Net) []string
- func MapIP6ToString(nws []IP6Net) []string
- func Mask(prefixLen int) *big.Int
- func NativelyLittle() bool
- func OpenTun(name string) (*os.File, string, error)
- type IP4
- type IP4Net
- func (n IP4Net) Contains(ip IP4) bool
- func (n *IP4Net) ContainsCIDR(other *IP4Net) bool
- func (n IP4Net) Empty() bool
- func (n IP4Net) Equal(other IP4Net) bool
- func (n *IP4Net) IncrementIP()
- func (n IP4Net) MarshalJSON() ([]byte, error)
- func (n IP4Net) Mask() uint32
- func (n IP4Net) Network() IP4Net
- func (n IP4Net) Next() IP4Net
- func (n IP4Net) Overlaps(other IP4Net) bool
- func (n IP4Net) String() string
- func (n IP4Net) StringSep(octetSep, prefixSep string) string
- func (n IP4Net) ToIPNet() *net.IPNet
- func (n *IP4Net) UnmarshalJSON(j []byte) error
- type IP6
- type IP6Net
- func (n IP6Net) Contains(ip *IP6) bool
- func (n *IP6Net) ContainsCIDR(other *IP6Net) bool
- func (n IP6Net) Empty() bool
- func (n IP6Net) Equal(other IP6Net) bool
- func (n *IP6Net) IncrementIP()
- func (n IP6Net) MarshalJSON() ([]byte, error)
- func (n IP6Net) Mask() *big.Int
- func (n IP6Net) Network() IP6Net
- func (n IP6Net) Next() IP6Net
- func (n IP6Net) Overlaps(other IP6Net) bool
- func (n IP6Net) String() string
- func (n IP6Net) StringSep(hexSep, prefixSep string) string
- func (n IP6Net) ToIPNet() *net.IPNet
- func (n *IP6Net) UnmarshalJSON(j []byte) error
Constants ¶
This section is empty.
Variables ¶
var NativeEndian binary.ByteOrder
NativeEndian is the ByteOrder of the current system.
Functions ¶
func EnsureV4AddressOnLink ¶ added in v0.10.0
EnsureV4AddressOnLink ensures that there is only one v4 Addr on `link` within the `ipn` address space and it equals `ipa`.
func EnsureV6AddressOnLink ¶ added in v0.15.0
EnsureV6AddressOnLink ensures that there is only one v6 Addr on `link` and it equals `ipn`. If there exist multiple addresses on link, it returns an error message to tell callers to remove additional address.
func GetDefaultGatewayInterface ¶ added in v0.14.0
func GetDefaultV6GatewayInterface ¶ added in v0.15.0
func GetInterfaceBySpecificIPRouting ¶ added in v0.18.0
func GetInterfaceIP4AddrMatch ¶ added in v0.14.0
func GetInterfaceIP4Addrs ¶ added in v0.17.0
func GetInterfaceIP6AddrMatch ¶ added in v0.15.0
func GetInterfaceIP6Addrs ¶ added in v0.17.0
func MapIP4ToString ¶ added in v0.21.0
func MapIP6ToString ¶ added in v0.21.0
func NativelyLittle ¶
func NativelyLittle() bool
Types ¶
type IP4 ¶
type IP4 uint32
func MustParseIP4 ¶ added in v0.5.6
func (IP4) IsPrivate ¶ added in v0.18.0
IsPrivate reports whether ip is a private address, according to RFC 1918 (IPv4 addresses)
func (IP4) MarshalJSON ¶
MarshalJSON: json.Marshaler impl
func (IP4) NetworkOrder ¶
func (*IP4) UnmarshalJSON ¶
UnmarshalJSON: json.Unmarshaler impl
type IP4Net ¶
similar to net.IPNet but has uint based representation
func (*IP4Net) ContainsCIDR ¶ added in v0.21.0
func (*IP4Net) IncrementIP ¶ added in v0.15.0
func (n *IP4Net) IncrementIP()
IncrementIP() increments the IP of IP4Net CIDR by 1
func (IP4Net) MarshalJSON ¶
MarshalJSON: json.Marshaler impl
func (*IP4Net) UnmarshalJSON ¶
UnmarshalJSON: json.Unmarshaler impl
type IP6 ¶ added in v0.15.0
func FromIP16Bytes ¶ added in v0.15.0
func GetIPv6SubnetMax ¶ added in v0.15.0
func GetIPv6SubnetMin ¶ added in v0.15.0
func MustParseIP6 ¶ added in v0.15.0
func (*IP6) IsPrivate ¶ added in v0.18.0
IsPrivate reports whether ip is a private address, according to RFC 4193 (IPv6 addresses).
func (IP6) MarshalJSON ¶ added in v0.15.0
MarshalJSON: json.Marshaler impl
func (*IP6) UnmarshalJSON ¶ added in v0.15.0
UnmarshalJSON: json.Unmarshaler impl
type IP6Net ¶ added in v0.15.0
similar to net.IPNet but has uint based representation
func FromIP6Net ¶ added in v0.15.0
func (*IP6Net) ContainsCIDR ¶ added in v0.21.0
func (*IP6Net) IncrementIP ¶ added in v0.15.0
func (n *IP6Net) IncrementIP()
IncrementIP() increments the IP of IP6Net CIDR by 1
func (IP6Net) MarshalJSON ¶ added in v0.15.0
MarshalJSON: json.Marshaler impl
func (*IP6Net) UnmarshalJSON ¶ added in v0.15.0
UnmarshalJSON: json.Unmarshaler impl