vpn

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: GPL-3.0 Imports: 32 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Connect() error
	Disconnect() error

	BytesTransmitted() (int64, int64, error)
}

type Config

type Config interface {
	NewClient(monitorService *monitors.MonitorService) (Client, error)
	Config() string

	Save(path, prefix string) (string, error)
}

func NewConfigFromTarget

func NewConfigFromTarget(configData ConfigData) (Config, error)

initialize the vpn client configuration

type ConfigData

type ConfigData interface {
	Name() string
	VPNType() string
	Data() []byte
	Delete() error
}

func NewVPNConfigData

func NewVPNConfigData(service Service) (ConfigData, error)

retrieve vpn configuration from the target

type Service

type Service interface {
	Connect() (*ServiceConfig, error)
	Disconnect() error

	GetSpaceNode() userspace.SpaceNode
}

type ServiceConfig

type ServiceConfig struct {
	PrivateKey string
	PublicKey  string

	IsAdminUser bool

	Name    string `json:"name,omitempty"`
	VPNType string `json:"vpnType,omitempty"`

	RawConfig json.RawMessage `json:"config,omitempty"`
}

type WGCtrlClient

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

func NewWireguardCtrlClient

func NewWireguardCtrlClient(ifaceName string) (*WGCtrlClient, error)

func (*WGCtrlClient) BytesTransmitted

func (wgcc *WGCtrlClient) BytesTransmitted() (int64, int64, error)

func (*WGCtrlClient) Configure

func (wgcc *WGCtrlClient) Configure(cfg wgtypes.Config) error

func (*WGCtrlClient) Device

func (wgcc *WGCtrlClient) Device() (*wgtypes.Device, error)

func (*WGCtrlClient) PublicKey

func (wgcc *WGCtrlClient) PublicKey() (string, error)

func (*WGCtrlClient) StatusText

func (wgcc *WGCtrlClient) StatusText() (string, error)

type WGCtrlService

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

func NewWireguardCtrlService

func NewWireguardCtrlService(
	ifaceName string,
	device *device.Device,
) *WGCtrlService

func (*WGCtrlService) Start

func (wgcs *WGCtrlService) Start() error

func (*WGCtrlService) Stop

func (wgcs *WGCtrlService) Stop() error

Jump to

Keyboard shortcuts

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