nat

package
v0.3.1-rc.7 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PseudoHeaderSum

func PseudoHeaderSum(ip IP, ipRaw []byte, protocol tcpip.TransportProtocolNumber) uint32

PseudoHeaderChecksum calculates the pseudo-header checksum for the given destination protocol and network address. Pseudo-headers are needed by transport layers when calculating their own checksum.

func StartGvisor

func StartGvisor(device io.ReadWriter, gateway, portal netip.Addr, mtu int32) (*TCP, *UDPv2, error)

Types

type Conn

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

func (*Conn) LocalAddr

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

func (*Conn) RawConn

func (c *Conn) RawConn() (net.Conn, bool)

func (*Conn) RemoteAddr

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

type IP

type IP interface {
	Payload() []byte
	SourceAddress() tcpip.Address
	DestinationAddress() tcpip.Address
	SetSourceAddress(tcpip.Address)
	SetDestinationAddress(tcpip.Address)
	SetChecksum(v uint16)
	PayloadLength() uint16
}

type TCP

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

func (*TCP) Accept

func (t *TCP) Accept() (net.Conn, error)

func (*TCP) Addr

func (t *TCP) Addr() net.Addr

func (*TCP) Close

func (t *TCP) Close() error

func (*TCP) SetDeadline

func (t *TCP) SetDeadline(time time.Time) error

type TransportProtocol

type TransportProtocol interface {
	SetChecksum(v uint16)
}

type UDPv2

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

func (*UDPv2) Close

func (u *UDPv2) Close() error

func (*UDPv2) ReadFrom

func (u *UDPv2) ReadFrom(buf []byte) (int, netip.AddrPort, netip.AddrPort, error)

func (*UDPv2) WriteTo

func (u *UDPv2) WriteTo(buf []byte, local, remote netip.AddrPort) (int, error)

Jump to

Keyboard shortcuts

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