wgserver

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WGClient

type WGClient interface {
	io.Closer
	ConfigureDevice(string, wgtypes.Config) error
	Device(string) (*wgtypes.Device, error)
	Devices() ([]*wgtypes.Device, error)
}

WGClient represents the wireguard client

type WGServer

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

WGServer keeps data about wireguard server

func NewWGServer

func NewWGServer() (WGServer, error)

NewWGServer creates a new instance of WGServer

func (WGServer) Close

func (wgs WGServer) Close() error

Close releases resources used by a WGServer.

func (WGServer) ConfigureDevice

func (wgs WGServer) ConfigureDevice(name string, cfg *pb.Config) error

ConfigureDevice configures a WireGuard device by its interface name.

If the device specified by name does not exist or is not a WireGuard device, an error is returned which can be checked using `errors.Is(err, os.ErrNotExist)` os.ErrInvalid is returned on invalid input.

func (WGServer) Device

func (wgs WGServer) Device(name string) (*pb.Device, error)

Device retrieves a WireGuard device by its interface name.

If the device specified by name does not exist or is not a WireGuard device, an error is returned which can be checked using `errors.Is(err, os.ErrNotExist)`.

func (WGServer) Devices

func (wgs WGServer) Devices() ([]*pb.Device, error)

Devices retrieves all WireGuard devices on this system.

Jump to

Keyboard shortcuts

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