Example #1
0
func main() {
	netIOCounterSt, err := net.NetIOCounters(true)

	if err != nil {
		log.Panicln(err)
	}

	for _, netIOSt := range netIOCounterSt {
		log.Println(netIOSt)
	}

	netProtoCounters, err := net.NetProtoCounters(nil)
	if err != nil {
		log.Panicln(err)
	}

	for _, netProtoSt := range netProtoCounters {
		log.Println(netProtoSt)
	}

	netConnectionStat, err := net.NetConnections("all")
	if err != nil {
		log.Panicln(err)
	}

	for _, netConnSt := range netConnectionStat {
		log.Println(netConnSt)
	}

}
Example #2
0
func (s *systemPS) NetProto() ([]net.NetProtoCountersStat, error) {
	return net.NetProtoCounters(nil)
}