net

package
v0.0.0-...-3f6d1d8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIPv4DefaultRoute

func IsIPv4DefaultRoute(destination string) (isDefaultRoute bool)

func IsIPv6DefaultRoute

func IsIPv6DefaultRoute(destination string) (isDefaultRoute bool)

Types

type DNSConfig

type DNSConfig struct {
	Servers       []string `json:"server,omitempty"`
	SearchDomains []string `json:"search,omitempty"`
}

type DNSResolver

type DNSResolver struct {
	Running DNSConfig `json:"running,omitempty"`
}

type Hostname

type Hostname struct {
	Running string `json:"running"`
}

type IPConfig

type IPConfig struct {
	Enabled   bool        `json:"enabled,omitempty"`
	Addresses []net.IPNet `json:"address,omitempty"`
}

func (*IPConfig) UnmarshalJSON

func (ipc *IPConfig) UnmarshalJSON(data []byte) error

type Iface

type Iface struct {
	Name  string   `json:"name"`
	Type  string   `json:"type"`
	State string   `json:"state"`
	MTU   int      `json:"mtu"`
	IPv4  IPConfig `json:"ipv4,omitempty"`
	IPv6  IPConfig `json:"ipv6,omitempty"`
}

type NetState

type NetState struct {
	Hostname Hostname    `json:"hostname,omitempty"`
	DNS      DNSResolver `json:"dns-resolver,omitempty"`
	Routes   RoutesRC    `json:"routes,omitempty"`
	Ifaces   []Iface     `json:"interfaces"`
}

func (*NetState) GetDefaultNextHopIface

func (ns *NetState) GetDefaultNextHopIface() (r *Iface, err error)

type Route

type Route struct {
	Destination  string `json:"destination"`
	NextHopIface string `json:"next-hop-interface"`
	NextHopAddr  string `json:"next-hop-address"`
}

type RoutesRC

type RoutesRC struct {
	Running []Route `json:"running"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳