ipnet

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package ipnet contains utility functions for IPv4 and IPv6 networks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Type

type Type int

Type is the type of IP networks.

const (
	// IP4 is IP version 4.
	IP4 Type = 4

	// IP6 is IP version 6.
	IP6 Type = 6
)

func (Type) Describe

func (t Type) Describe() string

Describe returns a human-readable description of the IP network.

func (Type) Int

func (t Type) Int() int

Int returns the version of the IP networks. It is either 4 or 6.

func (Type) NormalizeDetectedIP added in v1.8.0

func (t Type) NormalizeDetectedIP(ppfmt pp.PP, ip netip.Addr) (netip.Addr, bool)

NormalizeDetectedIP normalizes an IP into an IPv4 or IPv6 address.

func (Type) RecordType

func (t Type) RecordType() string

RecordType prints out the type of DNS records for the IP network. For IPv4, it is A; for IPv6, it is AAAA.

func (Type) UDPNetwork

func (t Type) UDPNetwork() string

UDPNetwork gives the network name for net.Dial.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL