vpn

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InterfaceMTU = 3500
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

func NewDevice

func NewDevice(existingTun tun.Device, interfaceName string, localIP net.IP, ipMask net.IPMask) (*Device, error)

func (*Device) Close

func (d *Device) Close() error

func (*Device) GetTempPacket

func (d *Device) GetTempPacket() *Packet

func (*Device) InterfaceName

func (d *Device) InterfaceName() (string, error)

func (*Device) OutboundChan

func (d *Device) OutboundChan() <-chan *Packet

func (*Device) PutTempPacket

func (d *Device) PutTempPacket(data *Packet)

func (*Device) WritePacket

func (d *Device) WritePacket(data *Packet, senderIP net.IP) error

TODO: batch write

type Packet

type Packet struct {
	Buffer [maxContentSize]byte
	Packet []byte
	Src    net.IP
	Dst    net.IP
	IsIPv6 bool
}

func (*Packet) Parse

func (data *Packet) Parse() bool

func (*Packet) ReadFrom

func (data *Packet) ReadFrom(stream io.Reader) (int64, error)

func (*Packet) RecalculateChecksum

func (data *Packet) RecalculateChecksum()

Jump to

Keyboard shortcuts

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