Documentation ¶
Index ¶
- Constants
- type IWGClient
- type WGClient
- func (c *WGClient) GetConnState() wg_core.ConnState
- func (c *WGClient) GetEthName(ifaceCfg *wg_core.WgInterface) string
- func (c *WGClient) GetEthNameByIface(iface string) string
- func (c *WGClient) GetInterfaceCfg(iface string) *wg_core.WgInterface
- func (c *WGClient) GetInterfaceIp(iface string) string
- func (c *WGClient) GetInterfaceListenPort(iface string) int
- func (c *WGClient) GetInterfacePeers(iface string) []wg_core.WgPeer
- func (c *WGClient) GetPeerIp(iface string) string
- func (c *WGClient) GetPublicKey() string
- func (c *WGClient) Init() error
- func (c *WGClient) InitKeys() error
- func (c *WGClient) IsConnecting() bool
- func (c *WGClient) IsForward(ifaceCfg *wg_core.WgInterface) bool
- func (c *WGClient) IsForwardByIface(iface string) bool
- func (c *WGClient) SetConnState(connState wg_core.ConnState)
- func (c *WGClient) SetInterfaceCfg(iface string, inCfg *wg_core.WgInterface)
- func (c *WGClient) SetInterfacePeers(iface string, peers []wg_core.WgPeer, replacePeers bool)
- type WgClientOptions
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 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 (*WGClient) GetEthName ¶
func (c *WGClient) GetEthName(ifaceCfg *wg_core.WgInterface) string
func (*WGClient) GetEthNameByIface ¶
func (*WGClient) GetInterfaceCfg ¶
func (c *WGClient) GetInterfaceCfg(iface string) *wg_core.WgInterface
func (*WGClient) GetInterfaceIp ¶
func (*WGClient) GetInterfaceListenPort ¶
func (*WGClient) GetInterfacePeers ¶
func (*WGClient) GetPublicKey ¶
func (*WGClient) IsConnecting ¶
func (*WGClient) IsForwardByIface ¶
func (*WGClient) SetConnState ¶
func (*WGClient) SetInterfaceCfg ¶
func (c *WGClient) SetInterfaceCfg(iface string, inCfg *wg_core.WgInterface)
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
Click to show internal directories.
Click to hide internal directories.