netutils

package
v0.0.0-...-760a2b5 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHostGatewayIP

func GetHostGatewayIP() (string, error)

GetHostGatewayIP returns the IP of the default gw as listed in the route list

func PMTUProbeToDestIP

func PMTUProbeToDestIP(dstIP string) (int, error)

PMTUProbeToDestIP runs ICMP pings to destination with varying payload size and returns the highest MTU that works. Currently works for IPv4 only

func RunDNSLookupUsingCustomResolver

func RunDNSLookupUsingCustomResolver(nameserver, hostFQDN string) ([]string, error)

RunDNSLookupUsingCustomResolver sends a dns lookup for hostFQDN to DNS server specified by nameserver. run dns lookup using github.com/miekg/dns code referenced from: https://github.com/bogdanovich/dns_resolver nameserver string format: "ip:port" hostFQDN string format: "abc.def.ghi."

func SendRecvHTTPMessage

func SendRecvHTTPMessage(url string, token string, body *[]byte) (int, error)

SendRecvHTTPMessage sends out a HTTP GET request to the url specified add token to X-Auth-Token as a Bearer token if token is specified Return body from GET response as part of body *[]byte

func SendRecvICMPMessage

func SendRecvICMPMessage(dstIP string, payloadSize int, dontFragment bool) (int, error)

SendRecvICMPMessage checks if icmp ping is successful. Looks at 2 icmp packets for required response returncode: 0 - no error. Echo reply received successfully

			   1 - Fragmentation required
            2 - got icmp but unknwon type

Types

This section is empty.

Jump to

Keyboard shortcuts

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