environment

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: AGPL-3.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	UNKNOWN uint8 = iota
	OFFLINE
	LIMITED // local network only
	PORTAL  // there seems to be an internet connection, but we are being intercepted
	ONLINE
)

Variables

This section is empty.

Functions

func ConnectionSucceeded

func ConnectionSucceeded()

ConnectionSucceeded should be called when a module was able to successfully connect to the internet (do not call too often)

func Connectivity

func Connectivity() uint8

Connectivity returns the current state of connectivity to the network/Internet

func Gateways

func Gateways() []*net.IP

Gateways returns the currently active gateways

func GetApproximateInternetLocation

func GetApproximateInternetLocation() (net.IP, error)

GetApproximateInternetLocation returns the IP-address of the nearest ping-answering internet node

func GetAssignedAddresses

func GetAssignedAddresses() (ipv4 []net.IP, ipv6 []net.IP, err error)

func GetAssignedGlobalAddresses

func GetAssignedGlobalAddresses() (ipv4 []net.IP, ipv6 []net.IP, err error)

func NetworkChanged

func NetworkChanged() <-chan struct{}

Types

type EnvironmentInterface

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

func NewInterface

func NewInterface() *EnvironmentInterface

func (*EnvironmentInterface) NetworkChanged

func (env *EnvironmentInterface) NetworkChanged() bool

type Nameserver

type Nameserver struct {
	IP     net.IP
	Search []string
}

func Nameservers

func Nameservers() []Nameserver

Nameservers returns the currently active nameservers

Jump to

Keyboard shortcuts

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