netstatus

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

netstatus provides utility functions for querying several aspects of the network/host, especially as pertains to monitoring.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanConnect

func CanConnect(host string, protocol string, timeout time.Duration) bool

CanConnect tests whether a connection can be made to a given host on its given port using protocol ("TCP"|"UDP")

func GetHexPorts

func GetHexPorts(protocol string) (ports []string)

GetHexPorts gets all open ports as hex strings from /proc/net/{tcp,udp} Its protocol argument can only be one of: "tcp" | "udp"

func GetInterfaces

func GetInterfaces() []net.Interface

GetInterfaces returns a list of network interfaces and handles any associated error. Just for DRY.

func InterfaceIPs

func InterfaceIPs(name string) (ifaceAddresses []*net.IP)

InterfaceIPs gets all the associated IP addresses of a given interface. If the interface can't be found, it will return nil.

func OpenPorts

func OpenPorts(protocol string) (ports []uint16)

OpenPorts gets a list of open/listening TCP or UDP ports as integers from the information at /proc/net/tcp and /proc/net/udp, which may not reflect all of the ports that can be accessed externally. Its protocol argument can only be one of: "tcp" | "udp"

func PortOpen

func PortOpen(protocol string, port uint16) bool

PortOpen reports whether or not the given (decimal) port is open Its protocol argument can only be one of: "tcp" | "udp"

func Resolvable

func Resolvable(host string) bool

Resolvable checks if the given host can be resolved on the TCP and UDP nets

func ValidIP

func ValidIP(ipStr string) bool

ValidIP returns a boolean answering the question "is this a valid IPV4/6 address?

Types

This section is empty.

Jump to

Keyboard shortcuts

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