backend

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Device(ctx context.Context, name string) (*Device, error)
	Up(ctx context.Context, options ConfigureOptions) (*Device, error)
	Down(ctx context.Context, name string) error
	Status(ctx context.Context, name string) (bool, error)
	Stats(ctx context.Context, name string) (*InterfaceStats, error)
	PeerStats(ctx context.Context, name string, peerPublicKey string) (*PeerStats, error)
	FindForeignServers(ctx context.Context, knownInterfaces []string) ([]*ForeignServer, error)
	Close(ctx context.Context) error
}

type ConfigureOptions

type ConfigureOptions struct {
	InterfaceOptions InterfaceOptions
	WireguardOptions WireguardOptions
}

func (ConfigureOptions) Validate

func (o ConfigureOptions) Validate() error

type Device

type Device struct {
	Interface Interface
	Wireguard Wireguard
}

type ForeignInterface

type ForeignInterface struct {
	Name      string
	Addresses []string
	Mtu       int
	State     string
}

type ForeignServer

type ForeignServer struct {
	Interface    *ForeignInterface
	Name         string
	Type         string
	PublicKey    string
	ListenPort   int
	FirewallMark int
	Peers        []*Peer
}

type Interface

type Interface struct {
	Name      string
	Addresses []string
	Mtu       int
}

type InterfaceOptions

type InterfaceOptions struct {
	Name    string
	Address string
	Mtu     int
}

func (InterfaceOptions) Validate

func (o InterfaceOptions) Validate() error

type InterfaceStats

type InterfaceStats struct {
	RxPackets         uint64
	TxPackets         uint64
	RxBytes           uint64
	TxBytes           uint64
	RxErrors          uint64
	TxErrors          uint64
	RxDropped         uint64
	TxDropped         uint64
	Multicast         uint64
	Collisions        uint64
	RxLengthErrors    uint64
	RxOverErrors      uint64
	RxCrcErrors       uint64
	RxFrameErrors     uint64
	RxFifoErrors      uint64
	RxMissedErrors    uint64
	TxAbortedErrors   uint64
	TxCarrierErrors   uint64
	TxFifoErrors      uint64
	TxHeartbeatErrors uint64
	TxWindowErrors    uint64
	RxCompressed      uint64
	TxCompressed      uint64
}

type Peer

type Peer struct {
	PublicKey           string
	Endpoint            string
	AllowedIPs          []net.IPNet
	PresharedKey        string
	PersistentKeepalive time.Duration
	Stats               PeerStats
}

type PeerOptions

type PeerOptions struct {
	PublicKey           string
	Endpoint            string
	AllowedIPs          []string
	PresharedKey        string
	PersistentKeepalive int
}

func (*PeerOptions) Validate

func (o *PeerOptions) Validate() error

type PeerStats

type PeerStats struct {
	LastHandshakeTime time.Time
	ReceiveBytes      int64
	TransmitBytes     int64
	ProtocolVersion   int
}

type Wireguard

type Wireguard struct {
	Name         string
	PublicKey    string
	PrivateKey   string
	ListenPort   int
	FirewallMark int
	Peers        []*Peer
}

type WireguardOptions

type WireguardOptions struct {
	PrivateKey   string
	ListenPort   *int
	FirewallMark *int
	Peers        []*PeerOptions
}

func (WireguardOptions) Validate

func (o WireguardOptions) Validate() error

Jump to

Keyboard shortcuts

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