network

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IncrementIP

func IncrementIP(ip net.IP)

IncrementIP increments a net.IP by 1

Types

type Network added in v1.9.0

type Network interface {
	Hostname() string
	Interface() *net.Interface
	IPNet() *net.IPNet
	Gateway() net.IP
	UserIP() net.IP
	Cidr() string
}

Network interface for accessing network properties

type UserNetwork added in v1.9.0

type UserNetwork struct {
	// contains filtered or unexported fields
}

UserNetwork data structure for implementing Network interface

func NewDefaultNetwork added in v1.9.0

func NewDefaultNetwork() (*UserNetwork, error)

NewDefaultNetwork returns a new instance of UserNetwork

func NewNetworkFromInterfaceName added in v1.9.0

func NewNetworkFromInterfaceName(interfaceName string) (*UserNetwork, error)

NewNetworkFromInterfaceName returns a UserNetwork instance from the provided interface name

func (*UserNetwork) Cidr added in v1.9.0

func (n *UserNetwork) Cidr() string

Cidr returns the cidr block associated with this network's interface

func (*UserNetwork) Gateway added in v1.9.0

func (n *UserNetwork) Gateway() net.IP

Gateway returns the default network gateway for this host

func (*UserNetwork) Hostname added in v1.9.0

func (n *UserNetwork) Hostname() string

Hostname returns the hostname for this host

func (*UserNetwork) IPNet added in v1.9.0

func (n *UserNetwork) IPNet() *net.IPNet

IPNet returns the *net.IPNet associated with this network's interface

func (*UserNetwork) Interface added in v1.9.0

func (n *UserNetwork) Interface() *net.Interface

Interface returns this network's interface

func (*UserNetwork) UserIP added in v1.9.0

func (n *UserNetwork) UserIP() net.IP

UserIP returns the default IP address assigned to this network's interface

Jump to

Keyboard shortcuts

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