wireguard

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PingInterval = 2 * time.Minute
)

Functions

func GetTNet

func GetTNet() *netstack.Net

GetTNet - Get the netstack Net object

func GetTUNAddress

func GetTUNAddress() string

GetTUNAddress - Get the TUN address

func ReadEnvelope

func ReadEnvelope(connection net.Conn) (*pb.Envelope, error)

ReadEnvelope - Reads a message from the wireguard connection using length prefix framing

func WGConnect

func WGConnect(address string, port uint16) (net.Conn, *device.Device, error)

WGConnect - Get a wg connection or die trying

func WriteEnvelope

func WriteEnvelope(connection net.Conn, envelope *pb.Envelope) error

WriteEnvelope - Writes a message to the wireguard socket using length prefix framing which is a fancy way of saying we write the length of the message then the message e.g. [uint32 length|message] so the receiver can delimit messages properly

func WritePing

func WritePing(connection net.Conn) error

WritePing - Write a ping message to the wireguard connection

Types

This section is empty.

Jump to

Keyboard shortcuts

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