Documentation
¶
Overview ¶
Package network observes the local network stack. It does not dial, listen, resolve names, change routes, configure interfaces, or contact remote hosts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct {
IP string `json:"ip"`
PrefixLength int `json:"prefix_length"`
Family string `json:"family"`
Scope string `json:"scope"`
}
Address is an address assigned to a local interface.
type CollectionStatus ¶
type CollectionStatus struct {
State string `json:"state"`
Detail string `json:"detail,omitempty"`
ObservedAt *time.Time `json:"observed_at,omitempty"`
}
CollectionStatus distinguishes empty OS data from unavailable or unsupported collection. State is complete, partial, permission-denied, unsupported, or unavailable.
type Interface ¶
type Interface struct {
Index int `json:"index"`
Name string `json:"name"`
MTU int `json:"mtu"`
HardwareAddress string `json:"hardware_address,omitempty"`
Flags []string `json:"flags"`
Addresses []Address `json:"addresses"`
}
Interface is an OS network interface visible to the current process.
type Options ¶
Options bounds records and collection time. Zero values select 256 interfaces, 4096 routes, 256 addresses per interface, and five seconds.
type Resolver ¶
type Resolver struct {
Servers []string `json:"servers"`
Search []string `json:"search"`
Options []string `json:"options"`
}
Resolver describes the local resolver configuration without performing a lookup. Servers never include credentials.
type Route ¶
type Route struct {
Destination string `json:"destination"`
Gateway string `json:"gateway,omitempty"`
Interface string `json:"interface,omitempty"`
Metric int `json:"metric,omitempty"`
Default bool `json:"default"`
}
Route is an entry in the local route table. Destination is CIDR. An empty gateway means an on-link route. Interface names are local OS identities.
type Snapshot ¶
type Snapshot struct {
Platform string `json:"platform"`
ObservedAt time.Time `json:"observed_at"`
Interfaces []Interface `json:"interfaces"`
Routes []Route `json:"routes"`
Resolver Resolver `json:"resolver"`
InterfaceStatus CollectionStatus `json:"interface_status"`
RouteStatus CollectionStatus `json:"route_status"`
ResolverStatus CollectionStatus `json:"resolver_status"`
}
Snapshot is a bounded, non-atomic observation of local network state.