Skip to content

Latest commit

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

GOnetstat

Netstat implementation in Golang.

This Package get data from /proc/net/tcp|6 and /proc/net/udp|6 and parse /proc/[0-9]/fd/[0-9] to match the correct inode.

Usage

TCP/UDP

tcp_data:=GOnetstat.Tcp()
udp_data:=GOnetstat.Udp()

This will return a array of a Process struct like this

typeProcessstruct {
UserstringNamestringPidstringExestringStatestringIpstringPortint64ForeignIpstringForeignPortint64
}

So you can loop through data output and format the output of your program in whatever way you want it. See the Examples folder!

TCP6/UDP6

tcp6_data:=GOnetstat.Tcp6()
udp6_data:=GOnetstat.Udp6()

The return will be a array of a Process struct like mentioned above. Still need to create a way to compress the ipv6 because is too long.

About

Netstat implementation in Go

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages