Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drael/GOnetstat
Netstat implementation in Go
https://github.com/drael/GOnetstat
netstat
Last synced: 28 days ago
JSON representation
Netstat implementation in Go
- Host: GitHub
- URL: https://github.com/drael/GOnetstat
- Owner: drael
- License: mit
- Created: 2014-05-31T18:40:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-10-04T13:24:15.000Z (about 4 years ago)
- Last Synced: 2024-02-15T11:32:37.938Z (10 months ago)
- Topics: netstat
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 99
- Watchers: 7
- Forks: 54
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- cybersecurity-golang-security - netstat - Netstat implementation in Go. (Linux Specific)
- awesome-go-security - netstat - Netstat implementation in Go. (Linux Specific)
README
# 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
```go
tcp_data := GOnetstat.Tcp()
udp_data := GOnetstat.Udp()
```This will return a array of a Process struct like this
```go
type Process struct {
User string
Name string
Pid string
Exe string
State string
Ip string
Port int64
ForeignIp string
ForeignPort int64
}
```
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
```go
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.