Documentation
¶
Index ¶
- Constants
- Variables
- type Auth
- type DNSList
- type EnvList
- type ErrListener
- type PackageList
- type Preferences
- func (p *Preferences) Commit() error
- func (p *Preferences) GetAdminURL() (string, error)
- func (p *Preferences) GetBlockInbound() (bool, error)
- func (p *Preferences) GetDisableClientRoutes() (bool, error)
- func (p *Preferences) GetDisableDNS() (bool, error)
- func (p *Preferences) GetDisableFirewall() (bool, error)
- func (p *Preferences) GetDisableIPv6() (bool, error)
- func (p *Preferences) GetDisableServerRoutes() (bool, error)
- func (p *Preferences) GetEnableSSHLocalPortForwarding() (bool, error)
- func (p *Preferences) GetEnableSSHRemotePortForwarding() (bool, error)
- func (p *Preferences) GetEnableSSHRoot() (bool, error)
- func (p *Preferences) GetEnableSSHSFTP() (bool, error)
- func (p *Preferences) GetManagementURL() (string, error)
- func (p *Preferences) GetPreSharedKey() (string, error)
- func (p *Preferences) GetRemoteJobsAllowed() (bool, error)
- func (p *Preferences) GetRosenpassEnabled() (bool, error)
- func (p *Preferences) GetRosenpassPermissive() (bool, error)
- func (p *Preferences) GetServerSSHAllowed() (bool, error)
- func (p *Preferences) SetAdminURL(url string)
- func (p *Preferences) SetBlockInbound(block bool)
- func (p *Preferences) SetDisableClientRoutes(disable bool)
- func (p *Preferences) SetDisableDNS(disable bool)
- func (p *Preferences) SetDisableFirewall(disable bool)
- func (p *Preferences) SetDisableIPv6(disable bool)
- func (p *Preferences) SetDisableServerRoutes(disable bool)
- func (p *Preferences) SetEnableSSHLocalPortForwarding(enabled bool)
- func (p *Preferences) SetEnableSSHRemotePortForwarding(enabled bool)
- func (p *Preferences) SetEnableSSHRoot(enabled bool)
- func (p *Preferences) SetEnableSSHSFTP(enabled bool)
- func (p *Preferences) SetManagementURL(url string)
- func (p *Preferences) SetPreSharedKey(key string)
- func (p *Preferences) SetRemoteJobsAllowed(allowed bool)
- func (p *Preferences) SetRosenpassEnabled(enabled bool)
- func (p *Preferences) SetRosenpassPermissive(permissive bool)
- func (p *Preferences) SetServerSSHAllowed(allowed bool)
- type SSOListener
- type SplitTunnelMode
- type SplitTunnelSettings
- type URLOpener
Constants ¶
const ( SplitTunnelModeOff = int(modeOff) SplitTunnelModeExclude = int(modeExclude) SplitTunnelModeInclude = int(modeInclude) )
The same modes as basic ints. gomobile drops a constant whose type is not a basic one, so these are what reaches the generated Java bindings, and they keep the Android side tied to the values above instead of repeating 0, 1, 2.
Variables ¶
var ( // EnvKeyNBForceRelay Exported for Android java client to force relay connections EnvKeyNBForceRelay = peer.EnvKeyNBForceRelay // EnvKeyNBLazyConn Exported for Android java client to configure lazy connection EnvKeyNBLazyConn = lazyconn.EnvLazyConn // EnvKeyNBInactivityThreshold Exported for Android java client to configure connection inactivity threshold EnvKeyNBInactivityThreshold = lazyconn.EnvInactivityThreshold )
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth can register or login new client
func NewAuth ¶
NewAuth instantiate Auth struct and validate the management URL
The configuration at cfgPath is reused when one is already there, and only created when it is not. Building a fresh in-memory config unconditionally gives the client a new WireGuard key on every call: the peer registers under that key, the key is written out, and any peer registered by an earlier call is orphaned on the server. It also breaks a client that enrols and then runs from the persisted config, because the identity it registered is not the one it runs with — the management stream rejects it with "no peer auth method provided".
func NewAuthWithConfig ¶
NewAuthWithConfig instantiate Auth based on existing config. cfgPath is the file the config was loaded from; it identifies the profile whose account email backs the login_hint.
func (*Auth) Login ¶
func (a *Auth) Login(resultListener ErrListener, urlOpener URLOpener, isAndroidTV bool)
Login try register the client on the server
func (*Auth) LoginWithSetupKeyAndSaveConfig ¶
func (a *Auth) LoginWithSetupKeyAndSaveConfig(resultListener ErrListener, setupKey string, deviceName string)
LoginWithSetupKeyAndSaveConfig test the connectivity with the management server with the setup key.
func (*Auth) SaveConfigIfSSOSupported ¶
func (a *Auth) SaveConfigIfSSOSupported(listener SSOListener)
SaveConfigIfSSOSupported test the connectivity with the management server by retrieving the server device flow info. If it returns a flow info than save the configuration and return true. If it gets a codes.NotFound, it means that SSO is not supported and returns false without saving the configuration. For other errors return false.
type DNSList ¶ added in v0.21.9
type DNSList struct {
// contains filtered or unexported fields
}
DNSList is a wrapper of []netip.AddrPort with default DNS port
func (*DNSList) Add ¶ added in v0.21.9
Add new DNS address to the collection, returns error if invalid
type EnvList ¶ added in v0.57.0
type EnvList struct {
// contains filtered or unexported fields
}
EnvList wraps a Go map for export to Java
type ErrListener ¶ added in v0.14.6
type ErrListener interface {
OnSuccess()
OnError(error)
}
ErrListener is async listener for mobile framework
type PackageList ¶ added in v0.78.0
type PackageList struct {
// contains filtered or unexported fields
}
PackageList wraps []string for gomobile compatibility.
func NewPackageList ¶ added in v0.78.0
func NewPackageList() *PackageList
NewPackageList creates an empty list to fill via Add.
func (*PackageList) Add ¶ added in v0.78.0
func (l *PackageList) Add(s string)
Add appends a package name, ignoring empty ones.
func (*PackageList) Get ¶ added in v0.78.0
func (l *PackageList) Get(i int) string
Get returns the entry at index i, or an empty string when out of range.
func (*PackageList) Size ¶ added in v0.78.0
func (l *PackageList) Size() int
Size returns the number of entries.
type Preferences ¶
type Preferences struct {
// contains filtered or unexported fields
}
Preferences exports a subset of the internal config for gomobile
func NewPreferences ¶
func NewPreferences(configPath string) *Preferences
NewPreferences creates a new Preferences instance
func (*Preferences) Commit ¶
func (p *Preferences) Commit() error
Commit writes out the changes to the config file
func (*Preferences) GetAdminURL ¶
func (p *Preferences) GetAdminURL() (string, error)
GetAdminURL reads URL from config file
func (*Preferences) GetBlockInbound ¶ added in v0.48.0
func (p *Preferences) GetBlockInbound() (bool, error)
GetBlockInbound reads block inbound setting from config file
func (*Preferences) GetDisableClientRoutes ¶ added in v0.48.0
func (p *Preferences) GetDisableClientRoutes() (bool, error)
GetDisableClientRoutes reads disable client routes setting from config file
func (*Preferences) GetDisableDNS ¶ added in v0.48.0
func (p *Preferences) GetDisableDNS() (bool, error)
GetDisableDNS reads disable DNS setting from config file
func (*Preferences) GetDisableFirewall ¶ added in v0.48.0
func (p *Preferences) GetDisableFirewall() (bool, error)
GetDisableFirewall reads disable firewall setting from config file
func (*Preferences) GetDisableIPv6 ¶ added in v0.71.0
func (p *Preferences) GetDisableIPv6() (bool, error)
GetDisableIPv6 reads disable IPv6 setting from config file
func (*Preferences) GetDisableServerRoutes ¶ added in v0.48.0
func (p *Preferences) GetDisableServerRoutes() (bool, error)
GetDisableServerRoutes reads disable server routes setting from config file
func (*Preferences) GetEnableSSHLocalPortForwarding ¶ added in v0.60.0
func (p *Preferences) GetEnableSSHLocalPortForwarding() (bool, error)
GetEnableSSHLocalPortForwarding reads SSH local port forwarding setting from config file
func (*Preferences) GetEnableSSHRemotePortForwarding ¶ added in v0.60.0
func (p *Preferences) GetEnableSSHRemotePortForwarding() (bool, error)
GetEnableSSHRemotePortForwarding reads SSH remote port forwarding setting from config file
func (*Preferences) GetEnableSSHRoot ¶ added in v0.60.0
func (p *Preferences) GetEnableSSHRoot() (bool, error)
GetEnableSSHRoot reads SSH root login setting from config file
func (*Preferences) GetEnableSSHSFTP ¶ added in v0.60.0
func (p *Preferences) GetEnableSSHSFTP() (bool, error)
GetEnableSSHSFTP reads SSH SFTP setting from config file
func (*Preferences) GetManagementURL ¶
func (p *Preferences) GetManagementURL() (string, error)
GetManagementURL reads URL from config file
func (*Preferences) GetPreSharedKey ¶
func (p *Preferences) GetPreSharedKey() (string, error)
GetPreSharedKey reads pre-shared key from config file
func (*Preferences) GetRemoteJobsAllowed ¶ added in v0.78.0
func (p *Preferences) GetRemoteJobsAllowed() (bool, error)
GetRemoteJobsAllowed reads the remote jobs opt-in from config file
func (*Preferences) GetRosenpassEnabled ¶ added in v0.47.0
func (p *Preferences) GetRosenpassEnabled() (bool, error)
GetRosenpassEnabled reads Rosenpass enabled status from config file
func (*Preferences) GetRosenpassPermissive ¶ added in v0.47.0
func (p *Preferences) GetRosenpassPermissive() (bool, error)
GetRosenpassPermissive reads Rosenpass permissive setting from config file
func (*Preferences) GetServerSSHAllowed ¶ added in v0.48.0
func (p *Preferences) GetServerSSHAllowed() (bool, error)
GetServerSSHAllowed reads server SSH allowed setting from config file
func (*Preferences) SetAdminURL ¶
func (p *Preferences) SetAdminURL(url string)
SetAdminURL stores the given URL and waits for commit
func (*Preferences) SetBlockInbound ¶ added in v0.48.0
func (p *Preferences) SetBlockInbound(block bool)
SetBlockInbound stores the given value and waits for commit
func (*Preferences) SetDisableClientRoutes ¶ added in v0.48.0
func (p *Preferences) SetDisableClientRoutes(disable bool)
SetDisableClientRoutes stores the given value and waits for commit
func (*Preferences) SetDisableDNS ¶ added in v0.48.0
func (p *Preferences) SetDisableDNS(disable bool)
SetDisableDNS stores the given value and waits for commit
func (*Preferences) SetDisableFirewall ¶ added in v0.48.0
func (p *Preferences) SetDisableFirewall(disable bool)
SetDisableFirewall stores the given value and waits for commit
func (*Preferences) SetDisableIPv6 ¶ added in v0.71.0
func (p *Preferences) SetDisableIPv6(disable bool)
SetDisableIPv6 stores the given value and waits for commit
func (*Preferences) SetDisableServerRoutes ¶ added in v0.48.0
func (p *Preferences) SetDisableServerRoutes(disable bool)
SetDisableServerRoutes stores the given value and waits for commit
func (*Preferences) SetEnableSSHLocalPortForwarding ¶ added in v0.60.0
func (p *Preferences) SetEnableSSHLocalPortForwarding(enabled bool)
SetEnableSSHLocalPortForwarding stores the given value and waits for commit
func (*Preferences) SetEnableSSHRemotePortForwarding ¶ added in v0.60.0
func (p *Preferences) SetEnableSSHRemotePortForwarding(enabled bool)
SetEnableSSHRemotePortForwarding stores the given value and waits for commit
func (*Preferences) SetEnableSSHRoot ¶ added in v0.60.0
func (p *Preferences) SetEnableSSHRoot(enabled bool)
SetEnableSSHRoot stores the given value and waits for commit
func (*Preferences) SetEnableSSHSFTP ¶ added in v0.60.0
func (p *Preferences) SetEnableSSHSFTP(enabled bool)
SetEnableSSHSFTP stores the given value and waits for commit
func (*Preferences) SetManagementURL ¶
func (p *Preferences) SetManagementURL(url string)
SetManagementURL stores the given URL and waits for commit
func (*Preferences) SetPreSharedKey ¶
func (p *Preferences) SetPreSharedKey(key string)
SetPreSharedKey stores the given key and waits for commit
func (*Preferences) SetRemoteJobsAllowed ¶ added in v0.78.0
func (p *Preferences) SetRemoteJobsAllowed(allowed bool)
SetRemoteJobsAllowed stores the given value and waits for commit
func (*Preferences) SetRosenpassEnabled ¶ added in v0.47.0
func (p *Preferences) SetRosenpassEnabled(enabled bool)
SetRosenpassEnabled stores whether Rosenpass is enabled
func (*Preferences) SetRosenpassPermissive ¶ added in v0.47.0
func (p *Preferences) SetRosenpassPermissive(permissive bool)
SetRosenpassPermissive stores the given permissive setting and waits for commit
func (*Preferences) SetServerSSHAllowed ¶ added in v0.48.0
func (p *Preferences) SetServerSSHAllowed(allowed bool)
SetServerSSHAllowed stores the given value and waits for commit
type SSOListener ¶ added in v0.14.6
SSOListener is async listener for mobile framework
type SplitTunnelMode ¶ added in v0.78.0
type SplitTunnelMode int
SplitTunnelMode is which of the two selections, if either, the tunnel applies. Its values land in the profile's stored preferences, so the constants below are append-only and must never be reordered.
type SplitTunnelSettings ¶ added in v0.78.0
type SplitTunnelSettings struct {
Mode int
Excluded *PackageList
Included *PackageList
}
SplitTunnelSettings is one profile's choice of which applications the tunnel carries. The two selections are kept apart because the platform applies one or the other and never both, and so that switching mode does not throw away the picks made in the other one.
Mode is an int rather than a SplitTunnelMode because gomobile carries only basic types across the binding. It holds one of the SplitTunnelMode* constants.
func NewSplitTunnelSettings ¶ added in v0.78.0
func NewSplitTunnelSettings() *SplitTunnelSettings
NewSplitTunnelSettings creates settings that carry every application.