ping

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: GPL-2.0 Imports: 26 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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, idleTimeout time.Duration) (*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 Destination

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

func ConnectDestination

func ConnectDestination(
	ctx context.Context,
	logger logger.ContextLogger,
	controlFunc control.Func,
	destination netip.Addr,
	writer PacketWriter,
	timeout time.Duration,
) (*Destination, error)

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 PacketWriter added in v0.9.0

type PacketWriter interface {
	WritePacket(packet []byte) error
}

type Port added in v0.9.0

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

func NewPort added in v0.9.0

func NewPort(ctx context.Context, logger logger.ContextLogger, controlFunc func(destination netip.Addr) control.Func, timeout time.Duration) *Port

func (*Port) AttachReturn added in v0.9.0

func (p *Port) AttachReturn(returnPath tun.Return) error

func (*Port) Close added in v0.9.0

func (p *Port) Close() error

func (*Port) DetachReturn added in v0.9.0

func (p *Port) DetachReturn(returnPath tun.Return) error

func (*Port) PortAddresses added in v0.9.0

func (p *Port) PortAddresses() (netip.Addr, netip.Addr)

func (*Port) PortMTU added in v0.9.0

func (p *Port) PortMTU() uint32

func (*Port) WritePackets added in v0.9.0

func (p *Port) WritePackets(packets [][]byte) 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