ios

package
v7.5.21 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: GPL-3.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureFileLogging

func ConfigureFileLogging(fullLogFilePath string, profilePath string) error

ConfigureFileLogging configures logging to log to files at the given fullLogFilePath and capture heap and goroutine profiles at the given profile path.

func IsActiveProDevice

func IsActiveProDevice(userID int, proToken, deviceID string) (bool, error)

IsActiveProDevice checks whether the given device is an active pro device

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 RedeemResellerCode

func RedeemResellerCode(userID int, proToken, deviceID, emailAddress, resellerCode, deviceName, currency string) error

RedeemResellerCode redeems the given reseller code, returning the payment_status and the plan

func ReportIssue

func ReportIssue(isPro bool, userID int, proToken, deviceID, appVersion, deviceModel, iosVersion, emailAddress, issue, appLogsDir, tunnelLogsDir, proxiesYamlPath string) error

ReportIssue reports an issue via email.

func RequestDeviceLinkingCode

func RequestDeviceLinkingCode(deviceID, deviceName string) (string, error)

RequestDeviceLinkingCode requests a new device linking code to allow linking the current device to a pro account via an existing pro device.

func RequestRecoveryEmail

func RequestRecoveryEmail(deviceID, deviceName, emailAddress string) error

RequestRecoveryEmail requests an account recovery email for linking to an existing pro account

func SetProfilePath

func SetProfilePath(path string)

Types

type Canceler

type Canceler struct {
	// contains filtered or unexported fields
}

Canceler providers a mechanism for canceling long running operations

func NewCanceler

func NewCanceler() *Canceler

NewCanceler creates a Canceller

func (*Canceler) Cancel

func (c *Canceler) Cancel()

Cancel cancels an operation

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) (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 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 ProCredentials

type ProCredentials struct {
	UserID   int
	ProToken string
}

ProCredentials are credentials that authenticate a pro account

func RecoverProAccount

func RecoverProAccount(deviceID, emailAddress string) (*ProCredentials, error)

RecoverProAccount attempts to recover an existing Pro account linked to this email address and device ID

func UserCreate

func UserCreate(deviceID string) (*ProCredentials, error)

UserCreate creates a new user account on the pro server

func ValidateDeviceLinkingCode

func ValidateDeviceLinkingCode(c *Canceler, deviceID, deviceName, code string) (*ProCredentials, error)

ValidateDeviceLinkingCode validates a device linking code to allow linking the current device to a pro account via an existing pro device. It will keep trying until it succeeds or the supplied Canceler is canceled. In the case of cancel, it will return nil credentials and a nil error.

func ValidateRecoveryCode

func ValidateRecoveryCode(deviceID, code string) (*ProCredentials, error)

ValidateRecoveryCode validates the given recovery code and finishes linking the device, returning the user_id and pro_token for the account.

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

type UDPDialer interface {
	Dial(host string, port int) UDPConn
}

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
}

type Writer

type Writer interface {
	Write([]byte) bool
}

Directories

Path Synopsis
This demo program allows testing the iOS packet forwarding functionality on a desktop machine using a TUN device.
This demo program allows testing the iOS packet forwarding functionality on a desktop machine using a TUN device.
connmaker
connmaker is a utility for creating lots of TCP connections without closing them, to help stress the memory on the ios demo app
connmaker is a utility for creating lots of TCP connections without closing them, to help stress the memory on the ios demo app

Jump to

Keyboard shortcuts

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