netstat

command
v0.0.0-...-e92761b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 5 Imported by: 0

README

netstat

A toy netstat re-implementation using GetExtendedTCPTable.

It also defines the relevant API Structs:

This demonstrates a type of API memory exchange where the API call expects to be given a buffer to write into. In this example, we allocated a buffer in Go's managed memory, and the API will write into the buffer if it is large enough, or it will request more memory if it is too small. We repeat the process of growing the bufer and calling the API function until it succeeds and, in this case, gives back a TCP connection table.

> netstat.exe
t> .\netstat.exe
PID     LOCAL                   REMOTE                  STATE
 14432  127.0.0.1:2015                                  LISTEN
 14432  127.0.0.1:2015          127.0.0.1:54550         ESTABLISHED
 5384   127.0.0.1:49671         127.0.0.1:49672         ESTABLISHED
 5384   127.0.0.1:49672         127.0.0.1:49671         ESTABLISHED

...

A slightly simpler example of calling APIs like this can be found in networkparams.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL