wintun

package
v0.0.0-...-a1e4504 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	PacketSizeMax   = 0xffff    // Maximum packet size
	RingCapacityMin = 0x20000   // Minimum ring capacity (128 kiB)
	RingCapacityMax = 0x4000000 // Maximum ring capacity (64 MiB)
)

Variables

This section is empty.

Functions

func RunningVersion

func RunningVersion() (string, error)

RunningVersion returns the version of the running Wintun driver.

func Uninstall

func Uninstall() error

Uninstall removes the driver from the system if no drivers are currently in use.

Types

type Adapter

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

func CreateAdapter

func CreateAdapter(name string, tunnelType string, requestedGUID *windows.GUID) (*Adapter, error)

CreateAdapter creates a Wintun adapter. name is the cosmetic name of the adapter. tunnelType represents the type of adapter and should be "Wintun". requestedGUID is the GUID of the created network adapter, which then influences NLA generation deterministically. If it is set to nil, the GUID is chosen by the system at random, and hence a new NLA entry is created for each new adapter.

func OpenAdapter

func OpenAdapter(name string) (*Adapter, error)

OpenAdapter opens an existing Wintun adapter by name.

func (*Adapter) Close

func (wintun *Adapter) Close() error

Close closes a Wintun adapter.

func (*Adapter) LUID

func (wintun *Adapter) LUID() (luid uint64)

LUID returns the LUID of the adapter.

func (*Adapter) StartSession

func (wintun *Adapter) StartSession(capacity uint32) (*Session, error)

type Packet

type Packet struct {
	Next *Packet              // Pointer to next packet in queue
	Size uint32               // Size of packet (max WINTUN_MAX_IP_PACKET_SIZE)
	Data *[PacketSizeMax]byte // Pointer to layer 3 IPv4 or IPv6 packet
}

Packet with data.

type Session

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

func (*Session) AllocateSendPacket

func (session *Session) AllocateSendPacket(packetSize int) ([]byte, error)

func (*Session) End

func (session *Session) End()

func (*Session) ReadWaitEvent

func (session *Session) ReadWaitEvent() windows.Handle

func (*Session) ReceivePacket

func (session *Session) ReceivePacket() ([]byte, error)

func (*Session) ReleaseReceivePacket

func (session *Session) ReleaseReceivePacket(packet []byte)

func (*Session) SendPacket

func (session *Session) SendPacket(packet []byte)

Jump to

Keyboard shortcuts

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