The Wayback Machine - https://web.archive.org/web/20180617162419/https://github.com/pytimer/win-netstat
Skip to content
windows netstat implementation in Golang.
Go
Switch branches/tags
Nothing to show
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
vendor/github.com/kbinani/win
.gitignore
Gopkg.lock
Gopkg.toml
LICENSE
README.md
common.go
netstat.go
tcp.go
udp.go

README.md

win-netstat

GoDoc

windows netstat implementation in Golang.

Getting Started

package main

import (
	"fmt"
	"log"

	"github.com/pytimer/win-netstat"
)

func tcp4() {
	conns, err := winnetstat.Connections("tcp4")
	if err != nil {
		log.Fatal(err)
	}
	for _, conn := range conns {
		fmt.Printf("%s:%d\t%d\t%s\n", conn.LocalAddr, conn.LocalPort, conn.OwningPid, conn.State)

	}
}

func tcp4WithPid(pid int) {
	conns, err := winnetstat.ConnectionsWithPid("tcp4", pid)
	if err != nil {
		log.Fatal(err)
	}
	for _, conn := range conns {
		fmt.Printf("%s:%d\t%d\t%s\n", conn.LocalAddr, conn.LocalPort, conn.OwningPid, conn.State)
	}
}

func main() {
	tcp4()
	tcp4WithPid(3848)
}

Examples

examples

Dependencies

kbinani/win

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.