network

package
v1.31.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBuiltinQEMU added in v1.30.0

func IsBuiltinQEMU(network string) bool

IsBuiltinQEMU returns if network is builtin or the legacy value user.

func ParseAddr added in v1.29.0

func ParseAddr(addr string) (net.IP, *net.IPNet, error)

ParseAddr will try to parse an ip or a cidr address

Types

type Interface

type Interface struct {
	IfaceName string
	IfaceIPv4 string
	IfaceMTU  int
	IfaceMAC  string
}

Interface contains main network interface parameters.

type Parameters

type Parameters struct {
	IP        string // IP address of network
	Netmask   string // dotted-decimal format ('a.b.c.d')
	Prefix    int    // network prefix length (number of leading ones in network mask)
	CIDR      string // CIDR format ('a.b.c.d/n')
	Gateway   string // taken from network interface address or assumed as first network IP address from given addr
	ClientMin string // second IP address
	ClientMax string // last IP address before broadcast
	Broadcast string // last IP address
	IsPrivate bool   // whether the IP is private or not
	Interface
	// contains filtered or unexported fields
}

Parameters contains main network parameters.

func FreeSubnet

func FreeSubnet(startSubnet string, step, tries int) (*Parameters, error)

FreeSubnet will try to find free private network beginning with startSubnet, incrementing it in steps up to number of tries.

Jump to

Keyboard shortcuts

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