Documentation
¶
Index ¶
- func ConfigureFileLogging(fullLogFilePath string, profilePath string) error
- func LogDebug(msg string)
- func LogError(msg string)
- func SetProfilePath(path string)
- type BandwidthTracker
- type ClientWriter
- type ConfigResult
- type Configurer
- type MemChecker
- type StatsTracker
- type UDPCallbacks
- type UDPConn
- type UDPDialer
- type UserConfig
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureFileLogging ¶
ConfigureFileLogging configures logging to log to files at the given fullLogFilePath and capture heap and goroutine profiles at the given profile path.
func LogDebug ¶
func LogDebug(msg string)
LogDebug logs the given msg to the swift logger at debug level
func LogError ¶
func LogError(msg string)
LogError logs the given msg to the swift logger at error level
func SetProfilePath ¶
func SetProfilePath(path string)
Types ¶
type BandwidthTracker ¶
type ClientWriter ¶
type ClientWriter interface { // Write writes the given bytes. As a side effect of writing, we periodically // record updated bandwidth quota information in the configured quota.txt file. // If user has exceeded bandwidth allowance, returns a positive integer // representing the bandwidth allowance. Write([]byte) (int, error) // Reconfigure forces the ClientWriter to update its configuration Reconfigure() Close() error }
func Client ¶
func Client(packetsOut Writer, udpDialer UDPDialer, memChecker MemChecker, configDir string, mtu int, capturedDNSHost, realDNSHost string, bandwidthTracker BandwidthTracker, statsTracker StatsTracker) (ClientWriter, error)
type ConfigResult ¶
type ConfigResult struct { // VPNNeedsReconfiguring indicates that something in the config changed and // that the VPN needs to be reconfigured. VPNNeedsReconfiguring bool // IPSToExcludeFromVPN lists all IPS that should be excluded from the VPNS's // routes in a comma-delimited string IPSToExcludeFromVPN string }
ConfigResult captures the result of calling Configure()
func Configure ¶
func Configure(configFolderPath string, userID int, proToken, deviceID string, refreshProxies bool, hardcodedProxies string) (*ConfigResult, error)
Configure fetches updated configuration from the cloud and stores it in configFolderPath. There are 5 files that must be initialized in configFolderPath - global.yaml, global.yaml.etag, proxies.yaml, proxies.yaml.etag and masquerade_cache. deviceID should be a string that uniquely identifies the current device. hardcodedProxies allows manually specifying a proxies.yaml configuration that overrides whatever we fetch from the cloud.
type Configurer ¶
type Configurer interface { Configure(userID int, proToken string, refreshProxies bool) (*ConfigResult, error) OpenGlobal() (*config.Global, string, bool, error) HasGlobalConfig() bool }
func NewConfigurer ¶
func NewConfigurer(configFolderPath string, userID int, proToken, deviceID, hardcodedProxies string) Configurer
NewConfigurer returns a new instance of Configurer
type MemChecker ¶
type MemChecker interface { // BytesRemain returns the number of bytes of memory left before we hit the system limit BytesRemain() int }
MemChecker checks the system's memory level
type StatsTracker ¶
type UDPCallbacks ¶
type UDPCallbacks struct {
// contains filtered or unexported fields
}
func (*UDPCallbacks) OnClose ¶
func (cb *UDPCallbacks) OnClose()
OnClose is called when the connection is closed.
func (*UDPCallbacks) OnDialSucceeded ¶
func (cb *UDPCallbacks) OnDialSucceeded()
OnConn is called once a connection is successfully dialed
func (*UDPCallbacks) OnError ¶
func (cb *UDPCallbacks) OnError(err error)
func (*UDPCallbacks) OnReceive ¶
func (cb *UDPCallbacks) OnReceive(dgram []byte)
func (*UDPCallbacks) OnWritten ¶
func (cb *UDPCallbacks) OnWritten()
type UDPConn ¶
type UDPConn interface { // RegisterCallbacks registers lifecycle callbacks for the connection. Clients of the UDPConn // must call this before trying to use WriteDatagram and ReceiveDatagram. RegisterCallbacks(cb *UDPCallbacks) // WriteDatagram writes one datagram to the UDPConn. Any resulting error from the right will // be reported to UDPCallbacks.OnError. WriteDatagram([]byte) // ReceiveDatagram requests receipt of the next datagram from the UDPConn. Once the datagram is received, // it's sent to UDPCallbacks.OnReceive. ReceiveDatagram() // Close closes the UDPConn Close() }
UDPConn is a UDP connection that bypasses the VPN. It is backed by an NWConnection on the Swift side.
See https://developer.apple.com/documentation/network/nwconnection.
type UDPDialer ¶
UDPDialer provides a mechanism for dialing outbound UDP connections that bypass the VPN. The returned UDPConn is not immediately ready for use, only once the UDPCallbacks receive OnDialSuccess is the UDPConn ready for use.
type UserConfig ¶
type UserConfig struct { common.UserConfigData Country string AllowProbes bool }