utils

package
v0.9.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ICMPv6NeighborAdvertisement = 136 // ICMPv6 Type for Neighbor Advertisement
)

Variables

This section is empty.

Functions

func ArpReqWithCtx

func ArpReqWithCtx(ctx context.Context, rCh chan<- int, AdvIP net.IP, ifName string) (int, error)

ArpReqWithCtx - sends a arp req given the DIP, SIP and interface name

func ArpResolver

func ArpResolver(dIP uint32)

ArpResolver - Try to resolve ARP for given address

func ConvertToSolicitedNodeMulticast added in v0.9.8

func ConvertToSolicitedNodeMulticast(ip net.IP) net.IP

ConvertToSolicitedNodeMulticast converts an IPv6 address to its solicited-node multicast address

func FileCreate

func FileCreate(fname string) int

FileCreate - Create a file

func FileExists

func FileExists(fname string) bool

FileExists - Check if file exists

func GenerateRandomMAC added in v0.9.8

func GenerateRandomMAC() (net.HardwareAddr, error)

func GetIfaceIP6Addr added in v0.9.8

func GetIfaceIP6Addr(ifName string) (addr net.IP, err error)

GetIfaceIP6Addr - Get interface IP address

func GetIfaceIPAddr added in v0.9.8

func GetIfaceIPAddr(ifName string) (addr net.IP, err error)

GetIfaceIPAddr - Get interface IP address

func HTTPSProber

func HTTPSProber(urls string, cert tls.Certificate, certPool *x509.CertPool, resp string) bool

HTTPSProber - Do a https probe for given url returns true/false depending on whether probing was successful

func IPHostCIDRString added in v0.9.8

func IPHostCIDRString(ip net.IP) string

sIPHostNetAddr - Check if provided address is a local subnet

func IsIPHostAddr

func IsIPHostAddr(ipString string) bool

IsIPHostAddr - Check if provided address is a local address

func IsIPHostNetAddr

func IsIPHostNetAddr(ip net.IP) bool

IsIPHostNetAddr - Check if provided address is a local subnet

func MkTunFsIfNotExist added in v0.9.4

func MkTunFsIfNotExist() error

func NetAdvertiseVI64Req added in v0.9.8

func NetAdvertiseVI64Req(targetIP net.IP, ifName string) (int, error)

func NetAdvertiseVIP4Req added in v0.9.8

func NetAdvertiseVIP4Req(AdvIP net.IP, ifName string) (int, error)

NetAdvertiseVIP4Req - sends a gratuitous arp reply given the DIP, SIP and interface name

func NetAdvertiseVIPReqWithCtx added in v0.9.8

func NetAdvertiseVIPReqWithCtx(ctx context.Context, rCh chan<- int, AdvIP net.IP, ifName string) (int, error)

NetAdvertiseVIPReqWithCtx - sends a gratuitous arp reply given the DIP interface name

func Ntohll

func Ntohll(i uint64) uint64

Ntohll - Network to host byte-order long long

func ReadPIDFile

func ReadPIDFile(pf string) int

ReadPIDFile - Read a PID file

func SendArpReq

func SendArpReq(AdvIP net.IP, ifName string) (int, error)

SendArpReq - sends a arp request given the DIP, SIP and interface name

func WriteFile

func WriteFile(fname, what string) error

WriteFile - Write a string to a file

Types

type Marker added in v0.9.8

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

Marker - context container

func NewMarker added in v0.9.8

func NewMarker(begin uint64, length uint64) *Marker

NewMarker - Allocate a set of markers

func (*Marker) GetMarker added in v0.9.8

func (M *Marker) GetMarker() (uint64, error)

GetMarker - Get next available marker

func (*Marker) ReleaseMarker added in v0.9.8

func (M *Marker) ReleaseMarker(id uint64) error

ReleaseMarker - Return a marker to the available list

Jump to

Keyboard shortcuts

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