osnetconfig

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package osnetconfig provides OS specific routines for detecting network changes and reading the route table; it uses cgo to to do so. Unfortunately some applications prefer to avoid the use of cgo entirely and this leads to a convoluted

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type IPRoute

type IPRoute struct {
	Net             net.IPNet
	Gateway         net.IP
	PreferredSource net.IP
	IfcIndex        int
}

IPRoute represents a route in the kernel's routing table. Any route with a nil Gateway is a directly connected network.

type Notifier

type Notifier struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Notifier represents a new network change Notifier.

func NewNotifier

func NewNotifier(delay time.Duration) *Notifier

NewNotifier returns a new network change Notifier.

func (*Notifier) GetIPRoutes

func (n *Notifier) GetIPRoutes(defaultOnly bool) []route.IPRoute

GetIPRoutes implements netconfig.Notifier. nolint: gocyclo

func (*Notifier) NotifyChange

func (n *Notifier) NotifyChange() (<-chan struct{}, error)

NotifyChange implements netconfig.Notifier.

func (*Notifier) Shutdown

func (n *Notifier) Shutdown()

Shutdown implements netconfig.Notifier.

Jump to

Keyboard shortcuts

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