base_client

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefEth string = "eth0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IWGClient

type IWGClient interface {
	Init() error

	SetPublicKey(publicKey string)
	SetPrivateKey(privateKey string)
	SetKeys(publicKey, privateKey string)
	GetPublicKey() string
	GetPeerIp(iface string) string

	CheckInterface(iface string) error
	UpdateConfig(iface string, replacePeers bool) error
	SetInterfaceCfg(iface string, cfg *wg_core.WgInterface)
	GetInterfaceCfg(iface string) *wg_core.WgInterface
	SetInterfacePeers(iface string, peers []wg_core.WgPeer, replacePeers bool)

	SetConnState(connState wg_core.ConnState)
	GetConnState() wg_core.ConnState
	IsConnecting() bool

	Close(iface string) error
	CloseAll() error
}

type WGClient

type WGClient struct {
	Opts         *WgClientOptions
	Logger       *zap.Logger
	WgInterfaces map[string]*wg_core.WgInterface

	KeyFile    string
	PublicKey  string
	PrivateKey string
	// contains filtered or unexported fields
}

func NewBaseWGClient

func NewBaseWGClient(logger *zap.Logger, opts *WgClientOptions) *WGClient

func (*WGClient) GetConnState

func (c *WGClient) GetConnState() wg_core.ConnState

func (*WGClient) GetEthName

func (c *WGClient) GetEthName(ifaceCfg *wg_core.WgInterface) string

func (*WGClient) GetEthNameByIface

func (c *WGClient) GetEthNameByIface(iface string) string

func (*WGClient) GetInterfaceCfg

func (c *WGClient) GetInterfaceCfg(iface string) *wg_core.WgInterface

func (*WGClient) GetInterfaceIp

func (c *WGClient) GetInterfaceIp(iface string) string

func (*WGClient) GetInterfaceListenPort

func (c *WGClient) GetInterfaceListenPort(iface string) int

func (*WGClient) GetInterfacePeers

func (c *WGClient) GetInterfacePeers(iface string) []wg_core.WgPeer

func (*WGClient) GetPeerIp

func (c *WGClient) GetPeerIp(iface string) string

func (*WGClient) GetPublicKey

func (c *WGClient) GetPublicKey() string

func (*WGClient) Init

func (c *WGClient) Init() error

func (*WGClient) InitKeys

func (c *WGClient) InitKeys() error

func (*WGClient) IsConnecting

func (c *WGClient) IsConnecting() bool

func (*WGClient) IsForward

func (c *WGClient) IsForward(ifaceCfg *wg_core.WgInterface) bool

func (*WGClient) IsForwardByIface

func (c *WGClient) IsForwardByIface(iface string) bool

func (*WGClient) SetConnState

func (c *WGClient) SetConnState(connState wg_core.ConnState)

func (*WGClient) SetInterfaceCfg

func (c *WGClient) SetInterfaceCfg(iface string, inCfg *wg_core.WgInterface)

func (*WGClient) SetInterfacePeers

func (c *WGClient) SetInterfacePeers(iface string, peers []wg_core.WgPeer, replacePeers bool)

func (*WGClient) SetKeys added in v0.0.5

func (c *WGClient) SetKeys(publicKey, privateKey string)

func (*WGClient) SetPrivateKey added in v0.0.5

func (c *WGClient) SetPrivateKey(privateKey string)

func (*WGClient) SetPublicKey added in v0.0.5

func (c *WGClient) SetPublicKey(publicKey string)

type WgClientOptions

type WgClientOptions struct {
	Interfaces  []string
	EthName     string
	Forward     bool
	Iptables    bool // use iptables to set, not postUp/postDown
	DeviceLog   bool
	AddListener bool
}

RawClient means use wireguard official api/modify official conf file and call wg sync cmd pop/connector agent will use RawClient=true for windows client RawClient=false, use uapi/wireguard-go client fir linux/mac/... client: TODO

Jump to

Keyboard shortcuts

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