Documentation ¶
Overview ¶
Package netdev gets the system's network device information: /proc/net/dev. Instead of returning a Go struct, it returns JSON serialized bytes. A function to deserialize the JSON serialized bytes into a structs.DevInfo struct is provided.
Note: the package name is netdev and not the final element of the import path (json).
Index ¶
- func Deserialize(p []byte) (*structs.DevInfo, error)
- func Get() (p []byte, err error)
- func Marshal(inf *structs.DevInfo) ([]byte, error)
- func NewTicker(d time.Duration) (joe.Tocker, error)
- func Serialize(inf *structs.DevInfo) (p []byte, err error)
- func Unmarshal(p []byte) (*structs.DevInfo, error)
- type Profiler
- type Ticker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deserialize ¶
Deserialize takes some JSON serialized bytes and unmarshals them as structs.DevInfo
func Get ¶
Get returns the current network device information as JSON serialized bytes using the package's global Profiler.
func NewTicker ¶
NewTicker returns a new Ticker containing a Data channel that delivers the data at intervals and an error channel that delivers any errors encountered. Stop the ticker to signal the ticker to stop running. Stopping the ticker does not close the Data channel; call Close to close both the ticker and the data channel.
Types ¶
type Profiler ¶
Profiler is used to process the network device information as JSON using the /proc/net/dev file.
func NewProfiler ¶
Returns an initialized Profiler; ready to use.