Documentation ¶
Index ¶
- func GenerateKeys(wgToolBinaryPath string) (publicKey string, privateKey string, err error)
- type ConnectionParams
- type WireGuard
- func (wg *WireGuard) Connect(stateChan chan<- vpn.StateInfo) error
- func (wg *WireGuard) DestinationIP() net.IP
- func (wg *WireGuard) Disconnect() error
- func (wg *WireGuard) Init() error
- func (wg *WireGuard) IsPaused() bool
- func (wg *WireGuard) OnRoutingChanged() error
- func (wg *WireGuard) Pause() error
- func (wg *WireGuard) ResetManualDNS() error
- func (wg *WireGuard) Resume() error
- func (wg *WireGuard) SetManualDNS(addr net.IP) error
- func (wg *WireGuard) Type() vpn.Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectionParams ¶
type ConnectionParams struct {
// contains filtered or unexported fields
}
ConnectionParams contains all information to make new connection
func CreateConnectionParams ¶
func CreateConnectionParams( hostPort int, hostIP net.IP, hostPublicKey string, hostLocalIP net.IP) ConnectionParams
CreateConnectionParams initializing connection parameters object
func (*ConnectionParams) SetCredentials ¶
func (cp *ConnectionParams) SetCredentials(privateKey string, localIP net.IP)
SetCredentials update WG credentials
type WireGuard ¶
type WireGuard struct {
// contains filtered or unexported fields
}
WireGuard structure represents all data of wireguard connection
func NewWireGuardObject ¶
func NewWireGuardObject(wgBinaryPath string, wgToolBinaryPath string, wgConfigFilePath string, connectionParams ConnectionParams) (*WireGuard, error)
NewWireGuardObject creates new wireguard structure
func (*WireGuard) Connect ¶
Connect - SYNCHRONOUSLY execute openvpn process (wait until it finished)
func (*WireGuard) DestinationIP ¶
DestinationIP - Get destination IP (VPN host server or proxy server IP address) This information if required, for example, to allow this address in firewall
func (*WireGuard) Disconnect ¶
Disconnect stops the connection
func (*WireGuard) Init ¶
Init performs basic initializations before connection It is useful, for example:
- for WireGuard(Windows) - to ensure that WG service is fully uninstalled
- for OpenVPN(Linux) - to ensure that OpenVPN has correct version
func (*WireGuard) OnRoutingChanged ¶
func (*WireGuard) Pause ¶
Pause doing required operation for Pause (temporary restoring default DNS)
func (*WireGuard) ResetManualDNS ¶
ResetManualDNS restores DNS
func (*WireGuard) Resume ¶
Resume doing required operation for Resume (restores DNS configuration before Pause)
func (*WireGuard) SetManualDNS ¶
SetManualDNS changes DNS to manual IP