Documentation
¶
Overview ¶
netstatus provides utility functions for querying several aspects of the network/host, especially as pertains to monitoring.
Index ¶
- func CanConnect(host string, protocol string, timeout time.Duration) bool
- func GetHexPorts(protocol string) (ports []string)
- func GetInterfaces() []net.Interface
- func InterfaceIPs(name string) (ifaceAddresses []*net.IP)
- func OpenPorts(protocol string) (ports []uint16)
- func PortOpen(protocol string, port uint16) bool
- func Resolvable(host string) bool
- func ValidIP(ipStr string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanConnect ¶
CanConnect tests whether a connection can be made to a given host on its given port using protocol ("TCP"|"UDP")
func GetHexPorts ¶
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 ¶
GetInterfaces returns a list of network interfaces and handles any associated error. Just for DRY.
func InterfaceIPs ¶
InterfaceIPs gets all the associated IP addresses of a given interface. If the interface can't be found, it will return nil.
func OpenPorts ¶
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 ¶
PortOpen reports whether or not the given (decimal) port is open Its protocol argument can only be one of: "tcp" | "udp"
func Resolvable ¶
Resolvable checks if the given host can be resolved on the TCP and UDP nets
Types ¶
This section is empty.