blob: 27898cca995c35431126789d45824c416ef080aa [file] [log] [blame]
David Why Use Two When One Will Do Presottof6813ec2014-07-11 16:12:54 -07001// package netconfig implements a network configuration watcher.
2// NOTE(p): This is also where we should put any code that changes
3// network configuration.
4
5package netconfig
6
David Why Use Two When One Will Do Presotto3e529b92014-09-29 10:24:01 -07007import (
8 "net"
9)
10
David Why Use Two When One Will Do Presottof6813ec2014-07-11 16:12:54 -070011// NetConfigWatcher sends on channel whenever an interface or interface address
12// is added or deleted.
13type NetConfigWatcher interface {
14 // Stop watching.
15 Stop()
16
17 // A channel that returns an item whenever the network addresses or
18 // interfaces have changed. It is up to the caller to reread the
19 // network configuration in such cases.
20 Channel() chan struct{}
21}
David Why Use Two When One Will Do Presotto3e529b92014-09-29 10:24:01 -070022
23// IPRoute represents a route in the kernel's routing table.
24// Any route with a nil Gateway is a directly connected network.
25type IPRoute struct {
26 Net net.IPNet
27 Gateway net.IP
28 PreferredSource net.IP
29 IfcIndex int
30}