vpn

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver interface {
	Protocol() string
	Start(context.Context, model.Node, config.Config, *log.Logger) (Session, error)
}

func DefaultDrivers

func DefaultDrivers() []Driver

type HealthChecker

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

func NewHealthChecker

func NewHealthChecker(configStore *config.Store, manager *Manager) *HealthChecker

func (*HealthChecker) Check

func (h *HealthChecker) Check(ctx context.Context) error

func (*HealthChecker) CheckSession

func (h *HealthChecker) CheckSession(ctx context.Context, session Session) error

type Manager

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

func NewManager

func NewManager(ctx context.Context, configStore *config.Store, database *store.Store, logger *log.Logger, drivers []Driver) *Manager

func (*Manager) ActiveIP

func (m *Manager) ActiveIP() string

func (*Manager) AfterRefresh

func (m *Manager) AfterRefresh(ctx context.Context)

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) DialContext

func (m *Manager) DialContext(ctx context.Context, network, address string) (net.Conn, error)

func (*Manager) Failover

func (m *Manager) Failover(ctx context.Context, cause error)

func (*Manager) FailoverSession

func (m *Manager) FailoverSession(ctx context.Context, expected Session, cause error)

func (*Manager) ListenPacket added in v0.0.2

func (m *Manager) ListenPacket(network, address string) (net.PacketConn, error)

func (*Manager) PreservedIP added in v0.0.3

func (m *Manager) PreservedIP() string

PreservedIP keeps a manually selected node available while VPN connections are paused, so resuming can restore the same selection after a refresh.

func (*Manager) ReconnectCurrent

func (m *Manager) ReconnectCurrent(ctx context.Context) error

func (*Manager) ResolveIPv4 added in v0.0.2

func (m *Manager) ResolveIPv4(ctx context.Context, host string) ([]net.IP, error)

func (*Manager) SelectManual

func (m *Manager) SelectManual(ctx context.Context, ip, protocol string) error

func (*Manager) Session

func (m *Manager) Session() Session

func (*Manager) SetDirectMode added in v0.0.3

func (m *Manager) SetDirectMode(ctx context.Context, enabled bool) error

SetDirectMode pauses or resumes managed VPN connections. Direct routing remains active while a resumed connection is being established.

func (*Manager) SetLastHealth

func (m *Manager) SetLastHealth(value time.Time)

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

func (*Manager) Status

func (m *Manager) Status(refreshRunning bool, lastRefresh time.Time, refreshErr error) model.RuntimeStatus

func (*Manager) SwitchAutomatic

func (m *Manager) SwitchAutomatic(ctx context.Context) error

func (*Manager) TestNode

func (m *Manager) TestNode(ctx context.Context, ip string) (speed int64, resultErr error)

type Session

type Session interface {
	DialContext(context.Context, string, string) (net.Conn, error)
	Wait(context.Context) error
	Close() error
}

Jump to

Keyboard shortcuts

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