internal

package
v1.7.6 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenPacket added in v1.5.0

func ListenPacket(network string, laddr string) (net.PacketConn, error)

Types

type BackendCheck added in v1.7.5

type BackendCheck struct {
	Name     string
	Detail   string
	Err      error
	Unknown  bool
	Optional bool
	Skipped  bool
}

func CheckProbeBackend added in v1.7.5

func CheckProbeBackend(ctx context.Context, o BackendOptions) []BackendCheck

type BackendOptions added in v1.7.5

type BackendOptions struct {
	Protocol                       string
	IPVersion, ICMPMode, Port, TOS int
	Source, Target                 net.IP
	Device                         string
}

type ICMPResponse added in v1.7.3

type ICMPResponse struct {
	Kind        ICMPResponseKind
	Description string
	Marker      string
}

type ICMPResponseKind added in v1.7.3

type ICMPResponseKind uint8
const (
	ICMPResponseUnknown ICMPResponseKind = iota
	ICMPResponseTransit
	ICMPResponseEchoReply
	ICMPResponsePortUnreachable
	ICMPResponseUnreachable
)

type ICMPSpec added in v1.5.0

type ICMPSpec struct {
	IPVersion    int
	ICMPMode     int
	EchoID       int
	SrcIP        net.IP
	DstIP        net.IP
	SourceDevice string
	FWMark       uint32
	FWMarkSet    bool
	// contains filtered or unexported fields
}

func NewICMPSpec added in v1.5.0

func NewICMPSpec(IPVersion, ICMPMode, echoID int, srcIP, dstIP net.IP) *ICMPSpec

func (*ICMPSpec) Close added in v1.5.0

func (s *ICMPSpec) Close()

func (*ICMPSpec) InitICMP added in v1.5.0

func (s *ICMPSpec) InitICMP() error

func (*ICMPSpec) ListenICMP added in v1.5.0

func (s *ICMPSpec) ListenICMP(ctx context.Context, ready chan struct{}, onICMP func(msg ReceivedMessage, finish time.Time, seq int)) error

func (*ICMPSpec) SendICMP added in v1.5.0

func (s *ICMPSpec) SendICMP(ctx context.Context, ipHdr gopacket.NetworkLayer, icmpHdr, icmpEcho gopacket.SerializableLayer, payload []byte) (time.Time, error)

type InitializationError added in v1.7.5

type InitializationError struct{ Err error }

InitializationError distinguishes unavailable probe resources from send errors. The scheduler must terminate instead of converting it into a timeout.

func (*InitializationError) Error added in v1.7.5

func (e *InitializationError) Error() string

func (*InitializationError) Unwrap added in v1.7.5

func (e *InitializationError) Unwrap() error

type PacketListener added in v1.5.0

type PacketListener struct {
	Conn     net.PacketConn
	Messages <-chan ReceivedMessage
	// contains filtered or unexported fields
}

PacketListener 负责监听网络数据包并通过通道传递接收到的消息 对外暴露只读的 Messages,避免外部代码误写

func NewPacketListener added in v1.5.0

func NewPacketListener(conn net.PacketConn) *PacketListener

NewPacketListener 创建一个新的数据包监听器 conn: 用于接收数据包的连接 返回初始化好的 PacketListener 实例

func (*PacketListener) Start added in v1.5.0

func (l *PacketListener) Start(ctx context.Context)

type ReceivedMessage added in v1.5.0

type ReceivedMessage struct {
	Peer net.Addr
	Msg  []byte
	Err  error
	ICMP ICMPResponse
}

type TCPSpec added in v1.5.0

type TCPSpec struct {
	IPVersion    int
	ICMPMode     int
	SrcIP        net.IP
	DstIP        net.IP
	DstPort      int
	PktSize      int
	SourceDevice string
	FWMark       uint32
	FWMarkSet    bool
	// contains filtered or unexported fields
}

func NewTCPSpec added in v1.5.0

func NewTCPSpec(IPVersion, ICMPMode int, srcIP, dstIP net.IP, dstPort int, pktSize int) *TCPSpec

func (*TCPSpec) Close added in v1.5.0

func (s *TCPSpec) Close()

func (*TCPSpec) InitICMP added in v1.5.0

func (s *TCPSpec) InitICMP() error

func (*TCPSpec) InitTCP added in v1.5.0

func (s *TCPSpec) InitTCP() error

func (*TCPSpec) ListenICMP added in v1.5.0

func (s *TCPSpec) ListenICMP(ctx context.Context, ready chan struct{}, onICMP func(msg ReceivedMessage, finish time.Time, data []byte)) error

func (*TCPSpec) ListenTCP added in v1.5.0

func (s *TCPSpec) ListenTCP(ctx context.Context, ready chan struct{}, onTCP func(srcPort, seq, ack int, peer net.Addr, finish time.Time)) error

func (*TCPSpec) SendTCP added in v1.5.0

func (s *TCPSpec) SendTCP(ctx context.Context, ipHdr gopacket.NetworkLayer, tcpHdr *layers.TCP, payload []byte) (time.Time, error)

type UDPSpec added in v1.5.0

type UDPSpec struct {
	IPVersion    int
	ICMPMode     int
	SrcIP        net.IP
	DstIP        net.IP
	DstPort      int
	SourceDevice string
	FWMark       uint32
	FWMarkSet    bool
	// contains filtered or unexported fields
}

func NewUDPSpec added in v1.5.0

func NewUDPSpec(IPVersion, ICMPMode int, srcIP, dstIP net.IP, dstPort int) *UDPSpec

func (*UDPSpec) Close added in v1.5.0

func (s *UDPSpec) Close()

func (*UDPSpec) InitICMP added in v1.5.0

func (s *UDPSpec) InitICMP() error

func (*UDPSpec) InitUDP added in v1.5.0

func (s *UDPSpec) InitUDP() error

func (*UDPSpec) ListenICMP added in v1.5.0

func (s *UDPSpec) ListenICMP(ctx context.Context, ready chan struct{}, onICMP func(msg ReceivedMessage, finish time.Time, data []byte)) error

func (*UDPSpec) ListenOut added in v1.5.0

func (s *UDPSpec) ListenOut(_ context.Context, _ chan struct{}, _ func(srcPort, seq, ttl int, start time.Time)) error

func (*UDPSpec) SendUDP added in v1.5.0

func (s *UDPSpec) SendUDP(ctx context.Context, ipHdr ipLayer, udpHdr *layers.UDP, payload []byte) (time.Time, error)

Jump to

Keyboard shortcuts

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