netutil

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectServer

func ConnectServer(config config.Config) net.Conn

ConnectServer connects to the server with the given address.

func DefaultRouteInterface

func DefaultRouteInterface() (string, error)

func DiscoverGateway

func DiscoverGateway(ipv4 bool) string

DiscoverGateway returns the local gateway IP address

func ExecCmd

func ExecCmd(c string, args ...string) string

ExecCmd executes the given command

func GetDefaultHttpHandleFunc

func GetDefaultHttpHandleFunc() http.Handler

func GetDefaultHttpResponse

func GetDefaultHttpResponse() []byte

GetDefaultHttpResponse returns the default http response

func GetDstKey

func GetDstKey(packet []byte) string

GetDstKey returns the destination key of the packets

func GetIPv4Dst

func GetIPv4Dst(packet []byte) net.IP

GetIPv4Dst returns the IPv4 destination address of the packet

func GetIPv4Src

func GetIPv4Src(packet []byte) net.IP

GetIPv4Src returns the IPv4 source address of the packet

func GetIPv6Dst

func GetIPv6Dst(packet []byte) net.IP

GetIPv6Dst returns the IPv6 destination address of the packet

func GetIPv6Src

func GetIPv6Src(packet []byte) net.IP

GetIPv6Src returns the IPv6 source address of the packet

func GetInterface

func GetInterface() (name string)

GetInterface returns the name of interface

func GetSrcKey

func GetSrcKey(packet []byte) string

GetSrcKey returns the source key of the packet

func IsIPv4

func IsIPv4(packet []byte) bool

IsIPv4 returns true if the packet is IPv4s

func IsIPv6

func IsIPv6(packet []byte) bool

IsIPv6 returns true if the packet is IPv6s

func LookupIP

func LookupIP(domain string) net.IP

LookupIP Lookup IP address of the given hostname

func LookupServerAddrIP

func LookupServerAddrIP(serverAddr string) net.IP

LookupServerAddrIP returns the IP of server address

func PrintErr

func PrintErr(err error, enableVerbose bool)

PrintErr returns the error log

func PrintErrF

func PrintErrF(enableVerbose bool, formatString string, args ...any)

PrintErrF returns the error log

func PrintStats

func PrintStats(enableVerbose bool, serverMode bool)

PrintStats returns the stats info

Types

type ExecCmdRecorder

type ExecCmdRecorder struct {
	// contains filtered or unexported fields
}

func (*ExecCmdRecorder) ExecCmd

func (ec *ExecCmdRecorder) ExecCmd(c string, args ...string) string

func (*ExecCmdRecorder) String

func (ec *ExecCmdRecorder) String() string

Jump to

Keyboard shortcuts

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