Пример #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)
	}

}
Пример #2
0
func (s *systemPS) NetConnections() ([]net.NetConnectionStat, error) {
	return net.NetConnections("all")
}