ping

package
v0.4.15 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: GPL-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDestination

func ConnectDestination(
	ctx context.Context,
	logger logger.ContextLogger,
	controlFunc control.Func,
	destination netip.Addr,
	routeContext tun.DirectRouteContext,
	timeout time.Duration,
) (tun.DirectRouteDestination, error)

Types

type Conn

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

func Connect

func Connect(ctx context.Context, privileged bool, controlFunc control.Func, destination netip.Addr) (*Conn, error)

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) IsClosed

func (c *Conn) IsClosed() bool

func (*Conn) ReadICMP

func (c *Conn) ReadICMP(buffer *buf.Buffer) error

func (*Conn) ReadIP

func (c *Conn) ReadIP(buffer *buf.Buffer) error

func (*Conn) SetLocalAddr

func (c *Conn) SetLocalAddr(addr netip.Addr)

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) WriteICMP

func (c *Conn) WriteICMP(buffer *buf.Buffer) error

func (*Conn) WriteIP

func (c *Conn) WriteIP(buffer *buf.Buffer) error

type ContextDestinationWriter

type ContextDestinationWriter struct {
	tun.DirectRouteContext
	// contains filtered or unexported fields
}

func NewContextDestinationWriter

func NewContextDestinationWriter(context tun.DirectRouteContext, destination netip.Addr) *ContextDestinationWriter

func (*ContextDestinationWriter) WritePacket

func (w *ContextDestinationWriter) WritePacket(packet []byte) error

type Destination

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

func (*Destination) Close

func (d *Destination) Close() error

func (*Destination) IsClosed

func (d *Destination) IsClosed() bool

func (*Destination) WritePacket

func (d *Destination) WritePacket(packet *buf.Buffer) error

type DestinationWriter

type DestinationWriter struct {
	tun.DirectRouteDestination
	// contains filtered or unexported fields
}

func NewDestinationWriter

func NewDestinationWriter(routeDestination tun.DirectRouteDestination, destination netip.Addr) *DestinationWriter

func (*DestinationWriter) WritePacket

func (w *DestinationWriter) WritePacket(packet *buf.Buffer) error

type SourceRewriter

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

func NewSourceRewriter

func NewSourceRewriter(ctx context.Context, logger logger.ContextLogger, inet4Address netip.Addr, inet6Address netip.Addr) *SourceRewriter

func (*SourceRewriter) CreateSession

func (m *SourceRewriter) CreateSession(session tun.DirectRouteSession, context tun.DirectRouteContext)

func (*SourceRewriter) DeleteSession

func (m *SourceRewriter) DeleteSession(session tun.DirectRouteSession)

func (*SourceRewriter) RewritePacket

func (m *SourceRewriter) RewritePacket(packet []byte)

func (*SourceRewriter) WriteBack

func (m *SourceRewriter) WriteBack(packet []byte) (bool, error)

type UnprivilegedConn

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

func (*UnprivilegedConn) Close

func (c *UnprivilegedConn) Close() error

func (*UnprivilegedConn) LocalAddr

func (c *UnprivilegedConn) LocalAddr() net.Addr

func (*UnprivilegedConn) Read

func (c *UnprivilegedConn) Read(b []byte) (n int, err error)

func (*UnprivilegedConn) ReadMsg

func (c *UnprivilegedConn) ReadMsg(b []byte, oob []byte) (n, oobn int, addr netip.Addr, err error)

func (*UnprivilegedConn) RemoteAddr

func (c *UnprivilegedConn) RemoteAddr() net.Addr

func (*UnprivilegedConn) SetDeadline

func (c *UnprivilegedConn) SetDeadline(t time.Time) error

func (*UnprivilegedConn) SetReadDeadline

func (c *UnprivilegedConn) SetReadDeadline(t time.Time) error

func (*UnprivilegedConn) SetWriteDeadline

func (c *UnprivilegedConn) SetWriteDeadline(t time.Time) error

func (*UnprivilegedConn) Write

func (c *UnprivilegedConn) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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