netutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// IPConntrackPath are ip_conntrack path.
	IPConntrackPath = "/proc/net/ip_conntrack" // old kernel
	// NFConntrackPath are nf_conntrack path.
	NFConntrackPath = "/proc/net/nf_conntrack" // new kernel
)

Functions

func FindConntrackPath

func FindConntrackPath() string

FindConntrackPath returns the conntrack proc path if exists.

func LocalIPAddrs

func LocalIPAddrs() ([]string, error)

LocalIPAddrs gets the string slice of localhost IPaddrs.

func LocalListeningPorts

func LocalListeningPorts() ([]string, error)

LocalListeningPorts returns the local listening ports. eg. [199, 111, 46131, 53, 8953, 25, 2812, 80, 8081, 22] ----------------------------------------------------------------------------------- [y_uuki@host ~]$ netstat -tln Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:199 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:46131 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:8953 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:2812 0.0.0.0:* LISTEN tcp 0 0 :::80 :::* LISTEN tcp 0 0 :::8081 :::* LISTEN tcp 0 0 :::22 :::* LISTEN

func ResolveAddr

func ResolveAddr(addr string) string

ResolveAddr lookup first hostname from IP Address.

Types

This section is empty.

Jump to

Keyboard shortcuts

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