network

package
v0.0.0-...-7a62f64 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const MacAddressPattern = `^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$`

Variables

View Source
var (
	ErrInvalidIpAddressClass = errors.New("invalid ip address class")
)
View Source
var (
	ErrInvalidMacAddress = errors.New("invalid mac address")
)

Functions

This section is empty.

Types

type Address

type Address string

func AddressFromString

func AddressFromString(v string) (Address, error)

func (Address) String

func (a Address) String() string

type IpAddress

type IpAddress struct {
	Version IpAddressVersion
	Address Address
	Nic     *Nic
}

func NewIpAddress

func NewIpAddress(version IpAddressVersion, address Address, nic *Nic) IpAddress

type IpAddressVersion

type IpAddressVersion int64
const (
	IpAddressV4 IpAddressVersion = iota
	IpAddressV6
	IpAddressTypeUnknown
)

func DetermineIpAddressType

func DetermineIpAddressType(ip string) IpAddressVersion

func IpAddressTypeFromString

func IpAddressTypeFromString(v string) IpAddressVersion

func (IpAddressVersion) String

func (i IpAddressVersion) String() string

type MacAddress

type MacAddress string

func MacAddressFromString

func MacAddressFromString(v string) (MacAddress, error)

func (MacAddress) String

func (m MacAddress) String() string

type Nic

type Nic struct {
	Name        string
	Virtual     bool
	MacAddress  *MacAddress
	Speed       *string
	Duplex      *string
	PCIAddress  *string
	Vendor      *string
	IpAddresses []*IpAddress
}

func NewNic

func NewNic(name string, macAddress *MacAddress, virtual bool, speed string, duplex string, pciAddress string) *Nic

Jump to

Keyboard shortcuts

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