connection

package
v0.9.12 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Clean            = "clean"
	Routed           = "routed"
	Connecting       = "connecting"
	Connected        = "connected"
	TokenUpdate      = "token update"
	TokenUpdateDone  = "token update done"
	ConfigurationGet = "configuration get"
	ConfigurationSet = "configuration set"
	LogDump          = "logs dumped"
	Disconnecting    = "disconnecting"
	DpdTimeout       = "dpd timeout"
	DnsLookup        = "dns lookup"
	ExternalIps      = "external ips"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Rest      *rest.Config
	WireGuard *wireguard.Config
	DoH       *doh.Config
	Plain     *plain.Config
}

type Connection

type Connection struct {
	sync.Mutex
	*Config
	// contains filtered or unexported fields
}

func New

func New(config *Config) *Connection

func (*Connection) AccessTokenFetch

func (c *Connection) AccessTokenFetch(notify bool) (accessToken string, err error)

func (*Connection) AccessTokenRefresh

func (c *Connection) AccessTokenRefresh(notify bool)

func (*Connection) Code

func (c *Connection) Code() (code string)

func (*Connection) Connect

func (c *Connection) Connect()

func (*Connection) DPD

func (c *Connection) DPD()

func (*Connection) Disconnect

func (c *Connection) Disconnect(notify bool)

func (*Connection) ExternalIPs

func (c *Connection) ExternalIPs() (err error)

func (*Connection) Filter

func (c *Connection) Filter()

func (*Connection) Init

func (c *Connection) Init() (err error)

func (*Connection) NotifySystemd

func (c *Connection) NotifySystemd(notifySystemd bool)

func (*Connection) PortForward

func (c *Connection) PortForward()

func (*Connection) ScheduleConnect

func (c *Connection) ScheduleConnect(in time.Duration)

func (*Connection) SetConnectNotify

func (c *Connection) SetConnectNotify(connectNotify func(err error))

func (*Connection) Shutdown

func (c *Connection) Shutdown(notify bool)

func (*Connection) State

func (c *Connection) State() *State

func (*Connection) StateNotify

func (c *Connection) StateNotify(state *State)

func (*Connection) StateNotifyFnAdd

func (c *Connection) StateNotifyFnAdd(stateNotifyFn *func(state *State))

func (*Connection) StateNotifyFnDel

func (c *Connection) StateNotifyFnDel(stateNotifyFn *func(state *State))

type State

type State struct {
	Code                  string    `json:"code"`
	Timestamp             time.Time `json:"timestamp"`
	*rest.ConnectResponse `json:",omitempty"`
	Rx                    int64  `json:"rx,omitempty"`
	Tx                    int64  `json:"tx,omitempty"`
	Host                  string `json:"host,omitempty"`
	ExternalIpv4          net.IP `json:"external_ip,omitempty"`
	ExternalIpv6          net.IP `json:"external_ipv6,omitempty"`
}

func (*State) SetCode

func (s *State) SetCode(code string) *State

Jump to

Keyboard shortcuts

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