Documentation
¶
Index ¶
- Constants
- Variables
- func DNSCheckAllServers(ctx context.Context, target string) (map[string]map[string][]netip.Addr, error)
- func FindAddrsOf(target string) (addrs []netip.Addr, err error)
- func FindFirstAddrOf(target string) (addr netip.Addr, err error)
- func FindHostnameOf(addr netip.Addr) (string, error)
- func GetExternalAddr(ctx context.Context) (netip.Addr, error)
- func GetUserAgent() string
- func IsRandomMac(mac net.HardwareAddr) bool
- func OuiLookup(mac net.HardwareAddr) (string, error)
- func ScanTcpPorts(ctx context.Context, target netip.Addr, options ...portscanRequestOptionFunc) (ports []int, err error)
- func SnmpGetInterfaces(ctx context.Context, addr netip.Addr, options ...snmpRequestOptionFunc) ([]netip.Prefix, error)
- func Traceroute4(ctx context.Context, target netip.Addr, opts ...Icmp4EchoOption) ([][]Icmp4EchoResponse, error)
- func WithArpNoCache() arpRequestOptionFunc
- func WithArpReplyTimeout(duration time.Duration) arpRequestOptionFunc
- func WithPortscanMaxworkers(ct int) portscanRequestOptionFunc
- func WithPortscanPortlist(list PortList) portscanRequestOptionFunc
- func WithPortscanPortlistName(name string) portscanRequestOptionFunc
- func WithPortscanReplyTimeout(duration time.Duration) portscanRequestOptionFunc
- func WithSnmpCommunity(community string) snmpRequestOptionFunc
- func WithSnmpPort(port int) snmpRequestOptionFunc
- func WithSnmpReplyTimeout(duration time.Duration) snmpRequestOptionFunc
- type ArpEntry
- func FindHardwareAddrOf(ctx context.Context, target netip.Addr, options ...arpRequestOptionFunc) (entry ArpEntry, err error)
- func FindUsingIfNameHardwareAddrOf(ctx context.Context, ifname string, target netip.Addr, ...) (entry ArpEntry, err error)
- func SnmpGetArpTable(ctx context.Context, addr netip.Addr, options ...snmpRequestOptionFunc) ([]ArpEntry, error)
- type Arper
- type CertData
- type Dnser
- type ErrNoResponseW
- type Icmp4EchoOption
- func I4EWithAllowAllErrors(allow bool) Icmp4EchoOption
- func I4EWithBetweenDuration(dur time.Duration) Icmp4EchoOption
- func I4EWithCount(ct int) Icmp4EchoOption
- func I4EWithIcmpID(id int) Icmp4EchoOption
- func I4EWithIcmpSeq(seq int) Icmp4EchoOption
- func I4EWithListenAddress(target netip.Addr) Icmp4EchoOption
- func I4EWithReadTimeout(to time.Duration) Icmp4EchoOption
- func I4EWithTTL(ttl int) Icmp4EchoOption
- type Icmp4EchoOptions
- type Icmp4EchoResponse
- type Icmp4EchoResponseStatistics
- type Icmp4Echoer
- type Ipifyer
- type Nettooler
- type PortList
- type Portscanner
- type SnmpInfo
- type SnmpSystemInfo
- type Snmper
- type TLS
- type TLSer
- type Utiler
Constants ¶
View Source
const ( ProtocolICMP = 1 ProtocolIPv6ICMP = 58 )
Variables ¶
View Source
var ( ErrEmptyResponse = errEmptyResponse{} ErrNoResponseFromRemote = errNoResponseFromRemote{} ErrInvalidAddr = errInvalidAddr{} ErrIPv6Unsupported = errIPv6Unsupported{} // ErrNoResponse = errors.New("no response from target") ErrConnectionRefused = errors.New("connection refused") ErrTTLExceeded = errors.New("ttl exceeded") ErrRandomizedMacAddress = errors.New("randomized mac address") ErrNoDnsNames = errors.New("no dns names") ErrInvalidPortListString = errors.New("invalid port list string") )
View Source
var DefaultPkg *pkg
Functions ¶
func DNSCheckAllServers ¶
func FindAddrsOf ¶
FindAddrsOf will resolve the A records into netip.Addr's for the given target. If no A records are returned a ErrEmptyResponse error will be returned
func FindFirstAddrOf ¶
FindFirstAddrOf will return the netip.Addr of the first A record of the target. If no A records are returned a ErrEmptyResponse error will be returned
func GetUserAgent ¶
func GetUserAgent() string
func IsRandomMac ¶
func IsRandomMac(mac net.HardwareAddr) bool
func ScanTcpPorts ¶
func SnmpGetInterfaces ¶
func Traceroute4 ¶
func Traceroute4(ctx context.Context, target netip.Addr, opts ...Icmp4EchoOption) ([][]Icmp4EchoResponse, error)
func WithArpNoCache ¶
func WithArpNoCache() arpRequestOptionFunc
func WithArpReplyTimeout ¶
func WithPortscanMaxworkers ¶
func WithPortscanMaxworkers(ct int) portscanRequestOptionFunc
func WithPortscanPortlist ¶
func WithPortscanPortlist(list PortList) portscanRequestOptionFunc
func WithPortscanPortlistName ¶
func WithPortscanPortlistName(name string) portscanRequestOptionFunc
func WithSnmpCommunity ¶
func WithSnmpCommunity(community string) snmpRequestOptionFunc
func WithSnmpPort ¶
func WithSnmpPort(port int) snmpRequestOptionFunc
func WithSnmpReplyTimeout ¶
Types ¶
type ArpEntry ¶
type ArpEntry struct {
Addr netip.Addr
MAC net.HardwareAddr
}
func FindHardwareAddrOf ¶
type ErrNoResponseW ¶
func (ErrNoResponseW) Error ¶
func (e ErrNoResponseW) Error() string
func (ErrNoResponseW) Unwrap ¶
func (e ErrNoResponseW) Unwrap() error
type Icmp4EchoOption ¶
type Icmp4EchoOption func(*Icmp4EchoOptions)
func I4EWithAllowAllErrors ¶
func I4EWithAllowAllErrors(allow bool) Icmp4EchoOption
func I4EWithBetweenDuration ¶
func I4EWithBetweenDuration(dur time.Duration) Icmp4EchoOption
func I4EWithCount ¶
func I4EWithCount(ct int) Icmp4EchoOption
func I4EWithIcmpID ¶
func I4EWithIcmpID(id int) Icmp4EchoOption
func I4EWithIcmpSeq ¶
func I4EWithIcmpSeq(seq int) Icmp4EchoOption
func I4EWithListenAddress ¶
func I4EWithListenAddress(target netip.Addr) Icmp4EchoOption
func I4EWithReadTimeout ¶
func I4EWithReadTimeout(to time.Duration) Icmp4EchoOption
func I4EWithTTL ¶
func I4EWithTTL(ttl int) Icmp4EchoOption
type Icmp4EchoOptions ¶
type Icmp4EchoResponse ¶
func Icmp4Echo ¶
func Icmp4Echo(ctx context.Context, target netip.Addr, opts ...Icmp4EchoOption) ([]Icmp4EchoResponse, error)
type Icmp4EchoResponseStatistics ¶
type Icmp4EchoResponseStatistics struct {
Peer netip.Addr
Start time.Time
TotalPackets int
TotalElapsed time.Duration
Mean time.Duration
Minimum time.Duration
Maximum time.Duration
StdDev time.Duration
SuccessCount int
PacketLoss float64
}
func CalculateIcmp4EchoResponseStatistics ¶
func CalculateIcmp4EchoResponseStatistics(rs []Icmp4EchoResponse) (ret Icmp4EchoResponseStatistics)
type Icmp4Echoer ¶
type Icmp4Echoer interface {
Icmp4Echo(context.Context, netip.Addr, ...Icmp4EchoOption) ([]Icmp4EchoResponse, error)
}
type Nettooler ¶
type Nettooler interface {
Arper
Dnser
Icmp4Echoer
Ipifyer
Portscanner
Snmper
TLSer
Utiler
}
type Portscanner ¶
type SnmpInfo ¶
type SnmpInfo struct {
SystemInfo SnmpSystemInfo
Interfaces []netip.Prefix
ArpTable []ArpEntry
}
type SnmpSystemInfo ¶
func SnmpGetSystemInfo ¶
type Snmper ¶
type Snmper interface {
FetchSNMPInfo(context.Context, netip.Addr, ...snmpRequestOptionFunc) (SnmpInfo, error)
SnmpGetSystemInfo(context.Context, netip.Addr, ...snmpRequestOptionFunc) (SnmpSystemInfo, error)
SnmpGetInterfaces(context.Context, netip.Addr, ...snmpRequestOptionFunc) ([]netip.Prefix, error)
SnmpGetArpTable(context.Context, netip.Addr, ...snmpRequestOptionFunc) ([]ArpEntry, error)
}
type TLS ¶
type Utiler ¶
type Utiler interface {
IsRandomMac(net.HardwareAddr) bool
GetUserAgent() string
OuiLookup(net.HardwareAddr) (string, error)
}
Click to show internal directories.
Click to hide internal directories.