Speedify
public class Speedify : NSObject, @preconcurrency SpeedifyDelegate, TunnelHelperDelegate
extension Speedify: SafeBrowsingMessageDelegate
This is the entry point of the Speedify SDK. Initialize SpeedifySDK by using the sharedInstance
property.
-
Subscribe to this delegate if you wish to be alerted when the SpeedifySDK returns the current:
Declaration
Swift
open var delegate: SpeedifySDKDelegate?
-
Current shared Instance of
Speedify
.Declaration
Swift
@objc public static let sharedInstance: Speedify
-
Current
AdapterData
. If set to nil, no data available.Declaration
Swift
private(set) public var adapterData: [AdapterData]? { get }
-
Current
ServerInformation
. If set to nil, no server is connected.Declaration
Swift
private(set) public var serverInformation: ServerInformation? { get }
-
Current
ConnectionStats
. If set to nil, no ConnectionStats are present.Declaration
Swift
private(set) public var connectionStats: [ConnectionStats]? { get }
-
Current
accountingData
. If set to nil, no accountingData is present.Declaration
Swift
private(set) public var accountingData: AccountingData? { get }
-
Current
privacySettings
. If set to nil, no privacySettings are present.Declaration
Swift
private(set) public var privacySettings: PrivacySettings? { get }
-
Current
extensionState
. If set to nil, the extension has not been started.Declaration
Swift
private(set) public var extensionState: NEVPNStatus? { get }
-
Current
DisconnectReason
. If set to nil, there are no current disconnect reasons.Declaration
Swift
private(set) public var lastDisconnectReason: DisconnectReason? { get }
-
When ‘true’ the extensions daemon is ready to receive messages.
Declaration
Swift
private(set) public var daemonMessagingIsReady: Bool { get }
-
Setting to true will tell the sdk not to send any messages to the extension until it is fully connected
Declaration
Swift
@objc public var waitUntilConnected: Bool { get set }
-
Declaration
Swift
@objc public var hasConnectPending: Bool
-
Current VPN Manager
NEVPNManager
. This property allows a user to determine the existing profile settings- @since 11.8
Declaration
Swift
@objc public var vpnManager: NEVPNManager { get }
-
Callbacks for the
SpeedifyStateDelegate
Declaration
Swift
public weak var stateDelegate: SpeedifyStateDelegate?
-
Callbacks for the
SpeedifyVendorUserDataDelegate
Declaration
Swift
public weak var vendorUserDataDelegate: SpeedifyVendorUserDataDelegate?
-
Callbacks for the
SpeedifyAdapterDelegate
Declaration
Swift
public weak var adapterDelegate: SpeedifyAdapterDelegate?
-
Callbacks for the
SpeedifyAccountingDelegate
Declaration
Swift
public weak var accountingDelegate: SpeedifyAccountingDelegate?
-
Callbacks for the
SpeedifySessionStatsPeriodDelegate
Declaration
Swift
public weak var sessionStatsPeriodDelegate: SpeedifySessionStatsPeriodDelegate?
-
Callbacks for the
SpeedifyConnectionStatsDelegate
Declaration
Swift
public weak var connectionStatsDelegate: SpeedifyConnectionStatsDelegate?
-
Callbacks for the
SpeedifySettingsDelegate
Declaration
Swift
public weak var settingsDelegate: SpeedifySettingsDelegate?
-
Callbacks for the
SpeedifySettingsErrorDelegate
Declaration
Swift
public weak var settingsErrorDelegate: SpeedifySettingsErrorDelegate?
-
Callbacks for the
SpeedifyVendorLocalSettingsDelegate
Declaration
Swift
public weak var vendorLocalSettingsDelegate: SpeedifyVendorLocalSettingsDelegate?
-
Callbacks for the
SpeedifyVendorRemoteSettingsDelegate
Declaration
Swift
public weak var vendorRemoteSettingsDelegate: SpeedifyVendorRemoteSettingsDelegate?
-
Callbacks for the
SpeedifyFirewallSettingsDelegate
Declaration
Swift
public weak var firewallSettingsDelegate: SpeedifyFirewallSettingsDelegate?
-
Callbacks for the
SpeedifyDomainWatchListDelegate
Declaration
Swift
public weak var localDomainWatchListDelegate: SpeedifyDomainWatchListDelegate?
-
Callbacks for the
SpeedifyStreamingStatsDelegate
Declaration
Swift
public weak var streamingStatsDelegate: SpeedifyStreamingStatsDelegate?
-
Callbacks for the
SpeedifyTunnelDelegate
Declaration
Swift
public weak var tunnelDelegate: SpeedifyTunnelDelegate?
-
Callbacks for the
SpeedifyLocalProxySettingsDelegate
Declaration
Swift
public weak var localProxySettingsDelegate: SpeedifyLocalProxySettingsDelegate?
-
Callbacks for the
SpeedifyDirectoryDomainDelegate
Declaration
Swift
public weak var directoryDomainDelegate: SpeedifyDirectoryDomainDelegate?
-
Callbacks for the
SpeedifyConnectedServerDelegate
Declaration
Swift
public weak var connectedServerDelegate: SpeedifyConnectedServerDelegate?
-
Callbacks for the
SpeedifyLastDisconnectDelegate
Declaration
Swift
public weak var disconnectEventDelegate: SpeedifyLastDisconnectDelegate?
-
Callbacks for the
SpeedifyLogSettingsDelegate
Declaration
Swift
public weak var logSettingsDelegate: SpeedifyLogSettingsDelegate?
-
Callbacks for the
SpeedifyLogSettingsDelegate
Declaration
Swift
public weak var streamingSettingsDelegate: SpeedifyStreamingSettingsDelegate?
-
Callbacks for the
SpeedifySpeedTestResultsDelegate
Declaration
Swift
public weak var speedTestResultsDelegate: SpeedifySpeedTestResultsDelegate?
-
Callbacks for the
SpeedifyServerSettingsDelegate
Declaration
Swift
public weak var serverSettingsDelegate: SpeedifyServerSettingsDelegate?
-
Callbacks for the
SpeedifyDisconnectEventDelegate
Declaration
Swift
public weak var lastDisconnectEventDelegate: SpeedifyDisconnectEventDelegate?
-
Callbacks for the
SpeedifyCaptivePortalDelegate
Declaration
Swift
public weak var cpDelegate: SpeedifyCaptivePortalDelegate?
-
Callbacks for the
SpeedifyLoginErrorDelegate
Declaration
Swift
public weak var loginErrorDelegate: SpeedifyLoginErrorDelegate?
-
Declaration
Swift
public weak var iAPDelegate: SpeedifyIapDelegate?
-
Declaration
Swift
public weak var pasDelegate: SpeedifyPasDelegate?
-
Declaration
Swift
public weak var privacySettingDelegate: SpeedifyPrivacySettingsDelegate?
-
Declaration
Swift
public weak var loggerDelegate: SpeedifyLoggerDelegate?
-
Declaration
Swift
public var sbiDelegate: SafeBrowsingInternalMessageDelegate?
-
Declaration
Swift
@objc public var sessionRespondsToLifeCycleEvents: Bool { get set }
-
Declaration
Swift
public var useSystemExtension: Bool { get set }
-
Declaration
Swift
public override init()
-
Declaration
Swift
@objc public func respondsToLifeCycleEvents(responds: Bool = false)
-
This calls update to refresh the current state, version, settings, connections and privacy settings.
Declaration
Swift
public func update(completionHandler: @escaping (_ done: Bool?) -> Void)
Parameters
completionHandler
A handler returning when this has completed
-
The will refresh state, accounting, connections, directory, settings, privacy settings, vendor local settings, remote vendor settings, vendor user data, firewall and directory
Declaration
Swift
public func refreshAll()
-
Start the PacketTunnel app extension.
This must be called to ensure message accuracy and the ability to keep the tunnel open. This checks the app extension state for
Invalid
Disconnecting
Disconnected
Upon reaching these states the function ensures the tunnel will be open. The timer fires every second to check the Tunnel State.
Declaration
Swift
@objc public func startTunnel(port: Int = 9330)
-
Sets the app name used for autoaccounts. @param name new app name @since 11.8
Declaration
Swift
public func setAppName(name: String)
-
- @method hasVPNPermissionWithCompletionHandler:
- @discussion This function asynchronously reads all of the NETunnelProvider configurations created by the calling app that have previously been saved to disk and returns true if a configuration is found.
Declaration
Swift
@objc public func reportVpnPermissionResult(completionHandler: @escaping (_ hasPermission: Bool, _ error: Error?) -> Void)
-
- @method initializeVPNPermissionWithCompletionHandler:
Declaration
Swift
@objc public func initializeVPNPermission(profile: String?, onDemandRules: [NEOnDemandRule]?, startTunnel: Bool, waitUntilConnected: Bool, completionHandler: @escaping (_ didSave: Bool, _ error: Error?) -> Void)
-
- @method resetVpnProfileWithCompletionHandler:
Declaration
Swift
@objc public func resetVpnProfile(completionHandler: @escaping (_ didSucceed: Bool, _ error: Error?) -> Void)
-
- @method profileIncludesAllRoutes:
This checks the current profiles value for it’s protocol configuration’s key
includesAllNetworks
Declaration
Swift
@available(macOSApplicationExtension 10.15, iOS 14.2, *) @objc public func profileIncludesAllNetworks(completionHandler: @escaping (_ includeAllNetworks: Bool) -> Void)
- @method profileIncludesAllRoutes:
This checks the current profiles value for it’s protocol configuration’s key
-
This will stop the tunnel and tear down the extension
Declaration
Swift
@objc public func stopTunnel()
-
Connect to a server by an automatic selection method. If already connected, this will disconnect before reconnecting. Unless called with
bysetting
, which will not trigger a reconnect.- closest: Closest public or private server to user
- closestPrivate: Closest private server to user
- last: Selects the last connected server
p2p: Server that supports P2P/BitTorrent
Declaration
Swift
public func connectAuto(connectOption: AutoConnectMethod, completionHandler: @escaping (_ serverInformation: ServerInformation?, _ error: ErrorType?) -> Void)
Parameters
connectOption
Return Value
completionHandler:
ServerInformation
-
Connect to a server by an automatic selection method. If already connected, this will disconnect before reconnecting.
Declaration
Swift
@objc public func connectAuto(connectOption: String)
Parameters
connectOption
method how to choose a server
-
Connect to a server with a specific city. If already connected, this will disconnect before reconnecting.
Declaration
Swift
public func connectByCity(country: String, city: String, completionHandler: @escaping (_ message: ServerInformation?, _ error: ErrorType?) -> Void)
Parameters
country
2-character ISO country code, ie: ‘us’
city
City code, ie: ‘atlanta’
Return Value
completionHandler:
ServerInformation
-
Connect to a server with a specific country. If already connected, this will disconnect before reconnecting.
Declaration
Swift
public func connectByCountry(country: String, completionHandler: @escaping (_ message: ServerInformation?, _ error: ErrorType?) -> Void)
Parameters
country
2-character ISO country code, ie: ‘us’.
Return Value
completionHandler:
ServerInformation
-
Connect to a server with a specific server number i.e 5. If already connected, this will disconnect before reconnecting.
Declaration
Swift
public func connectByServer(country: String, city: String, num: Int, completionHandler: @escaping (_ message: ServerInformation?, _ error: ErrorType?) -> Void)
Parameters
country
2-character ISO country code, ie: ‘us’.
city
City code, ie: ‘atlanta’
num
Specific server number i.e 5
Return Value
completionHandler:
ServerInformation
-
Connect to a specific server, without fallback. If already connected, this will disconnect before reconnecting. A list of valid servers can be obtained from {@link ISdkStateReceiver#OnDirectory OnDirectory}. Connect errors will be signalled in {@link ISdkStateReceiver#OnConnectError OnConnectError}. Chosen server will be signalled via {@link ISdkStateReceiver#OnConnectedServer OnConnectedServer} as connections to them are attempted.
@param country 2-char ISO country code @param city city name @param num server number @since 14.0
Declaration
Swift
public func connectByServerExact(country: String, city: String, num: Int)
-
Set the default connection method to a specific server, without fallback. Current settings available from {@link ISdkStateReceiver#OnServerSettings OnServerSettings}.
@param country 2-char ISO country code @param city city name @param num server number @since 14.0
Declaration
Swift
public func setConnectMethodServerExact(country: String, city: String, num: Int)
-
- Set the default connection method to an automatic selection method.
- Current settings available from
SpeedifyServerSettingsDelegate
. - @since 9.4
Declaration
Swift
public func setConnectMethodAuto(method: AutoConnectMethod)
-
Disconnect from the server.
Declaration
Swift
@objc public func disconnect()
-
Authenticate a new user.
setAppName
must be called before this.Declaration
Parameters
username
Username of the user you wish to authenticate
password
Password of the user you wish to authenticate
Return Value
completionHandler:
State
and optionalValidationError
-
Logs out of any current account and logs in to an automatically generated account for this device.
setAppName
must be called before this. If setting a custom directory, call ‘changeDirectoryURL(url: String)’ before calling this. This may take several seconds as the OS is queryied for the device id Login or auto-account creation errors will be signalled in ‘ErrorType’ return in the ‘login(username: String, password: String, completionHandler:@escaping (_ message: State?, _ error: ErrorType)->Void’ closure. Automatic accounts have false email address in the form of. @autoaccount.speedify.com. Declaration
Swift
public func loginAutoAccount()
Parameters
serviceAccount
A unique string to store UUID information. ex: “MyAppUUID”
-
- Comcast Loopback Function
setAppName
must be called before this. - @since 10.6
Declaration
Swift
public func loginLocalOnly()
- Comcast Loopback Function
-
Logs out of any current account and logs in to an automatically generated account for this device.
setAppName
must be called before this. If setting a custom directory, call ‘changeDirectoryURL(url: String)’ before calling this. This may take several seconds as the OS is queryied for the device id Login or auto-account creation errors will be signalled in ‘ErrorType’ return in the ‘login(username: String, password: String, completionHandler:@escaping (_ message: State?, _ error: ErrorType)->Void’ closure. Automatic accounts have false email address in the form of. @autoaccount.speedify.com. Declaration
Swift
public func loginAuto(_ serviceName: String)
Parameters
serviceName
Appends the auto account with the service name provided
serviceAccount
A unique string to store UUID information. ex: “MyAppUUID”
-
Logs out of any current account and logs in to an automatically generated account for this device.
setAppName
must be called before this. If setting a custom directory, call ‘changeDirectoryURL(url: String)’ before calling this. This may take several seconds as the OS is queryied for the device id Login or auto-account creation errors will be signalled in ‘ErrorType’ return in the ‘login(username: String, password: String, completionHandler:@escaping (_ message: State?, _ error: ErrorType)->Void’ closure. Automatic accounts have false email address in the form of. @autoaccount.speedify.com. Declaration
Parameters
serviceAccount
A unique string to store UUID information. ex: “MyAppUUID”
Return Value
completionHandler:
State
and optionalValidationError
-
- Authenticate a new user using oauth access token. You are responsible for fetching updated access tokens if you use this method.
setAppName
must be called before this.- If setting a custom directory, call
changeDirectoryURL(url: String)
before calling this. - Login errors will be signalled in completionHandler
error
. - An expired access token will give an error of
ErrorType.token_expired
, while invalid tokens will giveErrorType.credential
. *
Declaration
Swift
@available(*, deprecated, message: "Use loginOAuth(oauthAccessToken: String, completionHandler:@escaping (_ error: ErrorType?﹚->Void﹚") public func loginOAuth(oauthAccessToken: String, serviceAccount: String, completionHandler: @escaping (_ error: ErrorType?) -> Void)
-
- Authenticate a new user using oauth access token. You are responsible for fetching updated access tokens if you use this method.
setAppName
must be called before this.- If setting a custom directory, call
changeDirectoryURL(url: String)
before calling this. - Login errors will be signalled in completionHandler
error
. - An expired access token will give an error of
ErrorType.token_expired
, while invalid tokens will giveErrorType.credential
. * - @since 12.8
Declaration
Swift
public func loginOAuth(oauthAccessToken: String, completionHandler: @escaping (_ error: ErrorType?) -> Void)
-
Refreshes the current oauth access token. The application is responsible for fetching updated access tokens if using this method. If not logged in or logged in not using oauth, this will initiate a new login. Otherwise, the new token is stored to be used for future requests. Calling this from a logged in state presumes this is a token for the same user. If setting a custom directory, call
public func setDirectoryWithDomain(domain: String, completionHandler:@escaping (_ directory: DirectorySettings)->Void)
before calling this. Login errors will be signalled inSpeedifyLoginErrorDelegate
. An expired access token will give an error of typeErrorType.TOKEN_EXPIRED
, while invalid tokens will giveErrorType.CREDENTIAL
.@param newOAuthAccessToken New access token for the user you wish to authenticate @since 12.7
Declaration
Swift
public func refreshOAuthToken(newOAuthAccessToken: String)
-
This will log the current user out.
Declaration
Swift
@objc public func logout()
-
Change the basic mode of operation, between optimizing for speed or maximizing reliability.
Declaration
Swift
public func setMode(mode: BondingMode)
Parameters
mode
Return Value
This will show updated information inside of the delegate function
func settingsDidUpdate(settings: Settings)
-
Get a list of available servers from the directory list.
Declaration
Swift
public func getDirectory(completionHandler: @escaping (_ message: Dictionary<String, Any>) -> Void)
Return Value
completionHandler: A dictionary containing a server list
-
- Change directory server used for user authentication and server management.
- If using your own directory server, this must be called before
login
orloginAutoAccount
.
Declaration
Swift
@available(*, deprecated, message: "Use setDirectoryWithDomain(domain: String, completionHandler:@escaping (_ directory: DirectorySettings﹚->Void﹚") public func setDirectoryDomain(domain: String, completionHandler: @escaping (_ domain: String) -> Void)
-
- Change directory server used for user authentication and server management.
If using your own directory server, this must be called before
login
orloginAutoAccount
.
Declaration
Swift
public func setDirectoryWithDomain(domain: String, completionHandler: @escaping (_ directory: DirectorySettings) -> Void)
-
- Set an oauth gateway to use for directory server requests.
- If using your own directory gateway, this must be called before
login
orloginAutoAccount
. - Triggers
SpeedifyDirectoryDomainDelegate
, and (if logged in) {@link ISpeedifyHandler#OnDirectory OnDirectory} on domain change. - @since 10.5
Declaration
Swift
public func setDirectoryGatewayURI(gatewayUri: String)
-
- Sets if credentials will not be stored. *
- This includes passwords, OAuth tokens, and Safe Browsing init config.
- Triggers
SpeedifySDKDelegate privacySettingsDidUpdate
- If true, automatic login and connect at boot will not work.
- @since 10.5
Declaration
Swift
public func setDoNotStoreCredentials(doNotStore: Bool)
-
Reset the directory oauth gateway to defaults. Triggers
SpeedifyDirectoryDomainDelegate
. @since 10.5Declaration
Swift
public func resetDirectoryURI()
-
Reset the directory server to defaults.
Declaration
Swift
public func resetDirectoryDomain(completionHandler: @escaping (_ domain: String) -> Void)
-
Sets if ESNI is used when talking to the directory domain If using your own directory server, this must be called before
login
orloginAutoAccount
. TriggersSpeedifyDirectoryDomainDelegate
.Declaration
Swift
@available(*, deprecated, message: "ESNI has been deprecated") public func setESNIEnabled(enable: Bool)
Parameters
enable
If ESNI is used to talk to the directory @since 10.4 @deprecated as of 14.3.2
-
Objective-C’s implementation to read state
Declaration
Swift
@objc public func currentSpeedifyState() -> Int
-
Gets an activation code usable to login on the website.
- If setting a custom directory, call
SetDirectoryDomain()
before calling this. - @since 14.0
Declaration
Swift
public func getActivationCode(completionHandler: @escaping (_ code: ActivationCode) -> Void)
- If setting a custom directory, call
-
- Sets if settings in the local proxy domain watchlist entries are applied
- @since 13.2
Declaration
Swift
public func setLocalProxyGlobalDomainWatchlistEnable(watchlistEnabled: Bool)
-
Declaration
Swift
public func setNetworkShareHostEnable(enable: Bool)
-
Declaration
Swift
public func setNetworkShareClientEnable(enable: Bool)
-
Resets the local proxy domain watchlist entries to their default settings @since 13.2
Declaration
Swift
public func resetLocalProxyDomainWatchlist()
-
Subscribe or Unsubscribe from receiving the tunnel
ConnectionStats
andSessionStats
.Important
Important note: This must be enabled to receiveConnectionStats
updates.Example of some
SessionStats
.- Number of Failovers
- Total Connected Minutes
- Fastest Connected Mbps
Example of some
ConnectionStats
.- Time Connected
- total bytes per second
guid
Declaration
Swift
public func enableConnectionStatUpdates(enabled: Bool)
Return Value
completionHandler:
SessionStats
-
Enable periodic connection stats, adapter list updates, session stats, and streaming stats to be sent while Speedify is connected
Declaration
Swift
@objc public func enableStatUpdates(enabled: Bool, periods: [Double])
Parameters
enabled
enabled if connection stat updates should be continuously received
periods
periods timeframes of requested session stats, values in hours.
SessionStatPeriod
-
- Set vendor user data
- Current value available from
SpeedifyVendorUserDataDelegate
. - Discussion: You may send a JSON string to be saved inside of
vendorUserData
but be sure it is valid JSON or it will be ignored. - vendorSettings user data string
- @since 9.8
Declaration
Swift
public func setVendorUserData(vendorUserData: String)
-
Gets the vendor user data Triggers
SpeedifyVendorUserDataDelegate
. @since 9.8Declaration
Swift
public func refreshVendorUserData()
-
Requests information about the current connected VPN server You can read the value back via
serverInformation
or subscribe toserverSettingsReported
orserverInformationDidUpdate
@since 14.0Declaration
Swift
public func refreshConnectedServer()
-
Get configuration of the local proxy Triggers
SpeedifyLocalProxySettingsDelegate
. @since 9.2Declaration
Swift
public func refreshLocalProxy()
-
Declaration
Swift
public func getConnections(completionHandler: @escaping (_ message: [AdapterData]?) -> Void)
Return Value
completionHandler:
AdapterData
-
Set local vendor settings @param settingsJson a json object
- Current value available from
SpeedifyVendorLocalSettingsDelegate
. @param merge if true, settingsJson is merged in to existing local vendor settings. if false, settingsJson replaces existing local vendor settings @since 9.2
Declaration
Swift
public func setVendorLocalSettings(settings: [String : Any], merged: Bool)
- Current value available from
-
Gets the local vendor settings @since 9.2
Declaration
Swift
public func refreshVendorLocalSettings()
-
Refreshes streaming stats. @since 9.6
Declaration
Swift
public func refreshStreamingStats()
-
Get configuration of the firewall @since 9.2
Declaration
Swift
public func refreshFirewall()
-
Set the mode used by the firewall. @param mode how matches are treated @since 9.2
Declaration
Swift
public func setFirewallMode(mode: FirewallMode)
-
Set domains to firewall. @param domains domain names to deny/allow @since 9.2
Declaration
Swift
public func setFirewallDomains(domains: [String])
-
Set IPv6 address to firewall. @param ipv6 ipv6 addresses to deny/allow @since 9.3
Declaration
Swift
public func setFirewallIPv6(ipv6: [String])
-
Set domain watchlist settings for the local proxy @param domainWatchlist domain watchlist items Triggers delegate localProxySettingsDidUpdate @since 9.3
Declaration
Swift
public func setLocalProxyDomainWatchlistEnable(title: String, enabled: Bool)
-
Set domain watchlist settings for the local proxy If connected, this triggers a reconnect. Triggers delegate localProxySettingsDidUpdate @param domainWatchlist domain watchlist items @since 11.2
Declaration
Swift
public func setLocalProxyWatchList(domainWatchList: LocalProxyDomainWatchListItem)
-
Enables or disables the local proxy.
- @param enabled enable the local proxy
- Triggers delegate localProxySettingsDidUpdate
- @since 11.2
Declaration
Swift
public func setLocalProxyEnabled(enabled: Bool)
-
Set the match mode used by the local proxy. @param matchMode how matches are treated Triggers delegate localProxySettingsDidUpdate @since 11.2
Declaration
Swift
public func setLocalProxyMatchMode(matchMode: ProxyMatchMode)
-
Set domains to proxy locally, instead of going through the VPN. @param domains domain names to redirect through the local proxy Triggers LocalProxySettingsDelegate. @since 11.2
Declaration
Swift
public func setLocalProxyDomains(domains: [String])
-
Set IPv4 address to proxy locally, instead of going through the VPN. @param ipv4 ipv4 addresses to redirect through the local proxy Triggers delegate localProxySettingsDidUpdate @since 11.2
Declaration
Swift
public func setLocalProxyIPv4(ipv4: [String])
-
Set IPv4 address to firewall. @param ipv4 ipv4 addresses to deny/allow @since 9.2
Declaration
Swift
public func setFirewallIPv4(ipv4: [String])
-
Set ports to firewall. @param ports ports to be firewalled @since 9.2
Declaration
Swift
public func setFirewallPorts(ports: [FirewallPort])
-
Gets the remote vendor settings @since 9.2
Declaration
Swift
public func refreshRemoteVendorSettings()
-
Change the
ConnectionPriority
of each connection on the device.- Call the function
getConnections(completionHandler:@escaping (_ message: Dictionary<String, Any>)->Void)
before calling this function to ensure adapters are present.
Possible
ConnectionPriority
options include- ALWAYS = 0
- SECONDARY = 1
- BACKUP = 2
NEVER = 100
Declaration
Swift
public func setConnectionPriorities(connection: String, priority: ConnectionPriority)
Parameters
connection
Should be ‘en0’ or ‘cellular’. The getConnections function will retrieve the list for you.
priority
Return Value
This will show updated information inside of the delegate function
func connectionDataDidUpdate(connectionData: [AdapterData])
- Call the function
-
Set if automatic priority is allowed. Current settings available from
SpeedifySettings
.@param enabled if allowed @since 12.4
Declaration
Swift
public func enableAutomaticConnectionPriority(enable: Bool)
-
Change which directory servers to connect with.
If using your own directory server, this should always be called before
login()
orloginAutoAccount()
.
Declaration
Swift
@available(*, deprecated, message: "Please use the setDirectoryDomain(domain﹚ function instead") public func changeDirectoryURL(url: String)
Parameters
newURL
Pass in a host name or ‘Empty’ field to change it back to the original server list
Return Value
completionHandler: A dictionary containing the Connections and Session stats.
-
Change the encryption settings per adapter.
Declaration
Swift
public func setConnectionEncryption(adapterID: String, encrypt: Bool)
Parameters
adapterID
Name of the adapter. ex: “en0”
encrypt
A boolean value to determine if encryption should be
on or off
Return Value
This will show updated information inside of the delegate function
func connectionDataDidUpdate(connectionData: [AdapterData])
-
Change the encryption settings on the tunnel.
Declaration
Swift
public func setTunnelEncrypted(encrypted: Bool)
Parameters
encrypt
A boolean value to determine if encryption should be
on
oroff
.Return Value
This will show updated information inside of the delegate function
func connectionDataDidUpdate(connectionData: [AdapterData])
. -
Allow or disallow use of ChaCha for connection encryptions. Current value available from
Settings
.Declaration
Swift
public func setChaChaEncrypted(encrypted: Bool)
Parameters
encrypt
A boolean value to determine if ChaCha encryption should be
on
oroff
.Return Value
This will show updated information inside of the delegate function
func connectionDataDidUpdate(connectionData: [AdapterData])
. -
Set reporting encryption key.
Declaration
Swift
public func setReportingEncryptionKey(key128bit: String)
Parameters
key128bit
key A 16 byte ascii or 32byte hex string used to encrypt sensitive reports, or null to use default.
-
Set the overflow threshold.
Declaration
Swift
public func setOverflowThreshold(mbpsOverflow: Double)
Parameters
mbpsOverflow
The overflow threshold, in
megabits per second
.Return Value
This will show updated information inside of the delegate function
func settingsDidUpdate(settings: Settings)
. -
Set the priority overflow threshold, which is used when there is active priority traffic (i.e. real-time streams).
Declaration
Swift
public func setPriorityOverflowThreshold(mbpsOverflow: Double)
Parameters
mbpsOverflow
The priority overflow threshold, in
megabits per second
.Return Value
This will show updated information inside of the delegate function
func settingsDidUpdate(settings: Settings)
. -
Adds additional bytes to the adapter’s daily data usage limit for today. This value is not added to the base daily data usage limit.
Declaration
Swift
public func addAdapterDailyDataLimitBoost(adapterID: String, additionalBytes: Int64)
Parameters
adapterID
Name of the adapter. ex: “en0”
additionalBytes
Additional bytes that may be used today.
Return Value
This will show updated information inside of the delegate function
func settingsDidUpdate(settings: Settings)
. -
Set the data usage, in bytes, allowed on this adapter in a single day. Setting allowedBytes to 0 will disable this limit. Cellular adapters default to 200MB/month.
Declaration
Swift
public func setAdapterDailyDataLimit(adapterID: String, allowedBytes: Int64)
Parameters
adapterID
Name of the adapter. ex: “en0”
allowedBytes
Allowed bytes that may be used today.
Return Value
This will show updated information inside of the delegate function
func settingsDidUpdate(settings: Settings)
. -
Set the data usage, in bytes, allowed on this adapter in a single month. 0 for unlimited
Declaration
Swift
public func setAdapterMonthlyDataLimit(adapterID: String, allowedBytes: Int64, resetDay: Int64)
Parameters
adapterID
Name of the adapter. ex: “en0”
allowedBytes
Allowed bytes that may be used today.
resetDay
Day of the month that monthly usage is tracked from. 0 for last 30 days. Unused if allowedBytes is 0
Return Value
This will show updated information inside of the delegate function
func settingsDidUpdate(settings: Settings)
. -
Sets the adapter to unlimited daily data usage. Current value available on
AdapterData
Declaration
Swift
public func disableAdapterDailyDataLimit(adapterID: String)
Parameters
adapterID
Name of the adapter. ex: “en0”
-
Sets the adapter to unlimited monthly data usage. Current value available on
AdapterData
Declaration
Swift
public func disableAdapterMonthlyDataLimit(adapterID: String)
Parameters
adapterID
Name of the adapter. ex: “en0”
-
Acknowledge and clear message about a new adapter.
Declaration
Swift
public func handleNewAdapter(adapterID: String)
Parameters
adapterID
Name of the adapter. ex: “en0”
-
Set the download and upload speed rate limit on a connection.
- @deprecated as of 15.4. Use setConnectionRateLimit with download and upload separately
Declaration
Swift
public func setConnectionRateLimit(adapterID: String, bps: Int64)
Parameters
adapterId
Name of the adapter to be limited. ex “en0”
bps
limit in bits per second
-
Set the download and upload speed rate limit on a connection.
Declaration
Swift
public func setConnectionRateLimit(adapterID: String, downBps: Int64, upBps: Int64)
Parameters
adapterId
Name of the adapter to be limited. ex “en0”
downBps
download limit in bits per second
upBps
upload limit in bits per second
-
Will return the last 5 minutes worth of
ConnectionStats
*Important - This will not return anything on initial connect.Declaration
Swift
public func refreshHistoricalConnectionStats(completionHandler: @escaping (_ message: [ConnectionStatsGroup]?) -> Void)
-
This allows the extension to request supported event updates.
Declaration
Swift
public func enableEventUpdates(enabled: Bool)
-
Will trigger
SpeedifySettingsDelegate
Declaration
Swift
public func refreshSettings()
-
Declaration
Swift
public func refreshLogSettings()
-
Declaration
Swift
public func setDaemonLogSettings(daemon: DaemonLogSettings)
-
Set domains to identified as streams. Triggers ‘SpeedifyStreamingSettingsDelegate’. @param domains domain names to be identified as streams @since 10.9
Declaration
Swift
public func setStreamingDomains(domains: [String])
-
- Set IPv4 address to identified as streams.
- Triggers ‘SpeedifyStreamingSettingsDelegate’.
- @since 10.9
Declaration
Swift
public func setStreamingIPv4(ipv4: [String])
-
- Set IPv6 address to identified as streams. ** Triggers ‘SpeedifyStreamingSettingsDelegate’.
- @since 10.9
Declaration
Swift
public func setStreamingIPv6(ipv6: [String])
-
- Set ports to identified as streams. ** Triggers ‘SpeedifyStreamingSettingsDelegate’.
- @since 10.9
Declaration
Swift
public func setStreamingPorts(ports: [StreamingPort])
-
Set the language used for error messages
- Triggers
SpeedifySettingsDelegate
. - @since 10.8
Declaration
Swift
public func setLanguage(language: String)
- Triggers
-
Sets the
TransportMode
selection used for each connection. Current value available from delegatesettingsDidUpdate
.Declaration
Swift
public func setConnectionTransportMode(transportMode: TransportMode)
Parameters
transportMode
-
Sets whether to allow jumbo packets over the VPN tunnel. Current value available from delegate
settingsDidUpdate
.Declaration
Swift
public func setJumboPackets(useJumbo: Bool)
-
Sets whether to allow header compression on packets over the VPN tunnel. Current value available from delegate
settingsDidUpdate
.Declaration
Swift
public func setHeaderCompression(enable: Bool)
-
Set if Speedify should autmatically connect when the daemon starts. Triggers ‘SpeedifySettingsDelegate’. @param enabled automatically connect @since 9.4
Declaration
Swift
public func setStartupConnect(enabled: Bool)
-
Declaration
Swift
@objc public func setAllowTunnelBypass(_ allowTunnelBypass: Bool)
-
Allows other apps to bind their sockets around the VPN tunnel, directly on other network adapters. Current value available from delegate
privacySettingsDidUpdate
. Default Value is true. @since 11.9.2Declaration
Swift
@available(macOS 10.15, iOS 14.0, *) @objc public func setIPLeakProtection(_ ipLeakProtection: Bool)
-
Declaration
Swift
@objc public func refreshState()
-
Refresh account data. Current value available from delegate
accountingDataDidUpdate
.Declaration
Swift
@objc public func refreshAccounting()
-
Declaration
Swift
public func listenForExtensionStateUpdates(completionHandler: @escaping (_ state: String) -> Void)
-
Sets how to handle an adapter that has hit its daily or monthly data limit. Current value available on
AdapterData
objects returned fromAdapterUsageData
.Declaration
Swift
public func setAdapterOverlimitRatelimit(adapterID: String, bps: Int64)
Parameters
adapterID
name of the adapter. ex: “en0”.
-
Tells the daemon to stop alerting the SDK about an adapter’s overlimit status
Declaration
Swift
public func handleAdapterOverlimit(adapterID: String)
Parameters
adapterID
Current adapter to handle i.e en0
-
Copies logs created by the daemon into the shared App Group Container
- App Group Capabilities are mandatory when creating logs
Please add the following key to the Container and PacketTunnel info.plist
NSExtensionFileProviderDocumentGroup YOUR APP GROUP NAME
Note
TheNEVPNStatus
state MUST beConnected
orReasserting
or the result of the call will not be a success. You can check the current state of the extension usingpublic func currentExtensionState()
. Possible extension states:- Invalid
- Disconnected
- Disconnecting
- Connecting
- Connected
- Reasserting
Declaration
Swift
@objc public func generateLogs(completionHandler: @escaping (_ success: Bool) -> Void)
Return Value
completionHandler: Bool to indicate when the files are ready and copied over.
- App Group Capabilities are mandatory when creating logs
Please add the following key to the Container and PacketTunnel info.plist
-
- Set IP addresses of the DNS servers to use
Current value available from
PrivacySettings
.
Declaration
Swift
public func setDNSServers(_ dnsAddrs: [String])
-
Toggles VPN On Demand.
When On Demand is on, the operating system will automatically reconnect the VPN whenever internet is available. This setting persists across reboots (so if you set it on, the device will automatically reconnect the VPN after reboot).
Declaration
Swift
@objc public func setOnDemand(ondemand: Bool)
Parameters
ondemand
Boolean that toggles the VPN onDemand feature.
-
Toggles VPN On Demand. When On Demand is on, the operating system will automatically reconnect the VPN whenever internet is available. This setting persists across reboots (so if you set it on, the device will automatically reconnect the VPN after reboot).
- @since 11.1
Declaration
Swift
@objc public func setOnDemandWithRules(with onDemandRules: [NEOnDemandRule]?, onDemandEnabled: Bool)
Parameters
onDemandRules
OnDemand Connect or Disconnect rules
onDemandEnabled
Boolean that toggles the VPN onDemand feature.
-
Check if the onDemand setting is currently enabled.
Declaration
Swift
public func isOnDemandEnabled() -> Bool
Return Value
Boolean to determine if onDemand is enabled or disabled.
-
Checks connected networks for captive portals Triggers {@link ISpeedifyHandler#OnCaptivePortals OnCaptivePortals}. @since 11.3
Declaration
Swift
public func refreshCaptivePortals()
-
Enable captive portal mode, sending all traffic over the specified network @param adapterID network to operate captive portal mode over @since 11.3
Declaration
Swift
public func enableCaptivePortalMode(adapterID: String)
-
Enable captive portal mode, sending all traffic over the specified network @param adapterID network to operate captive portal mode over @since 11.3
Declaration
Swift
public func disableCaptivePortalMode()
-
Erase all log files and log zips.
Note that the current active log file is not erased. @since 10.5
Declaration
Swift
public func eraseAllLogFiles()
-
Refresh privacy settings. Triggers
privacySettingsDidUpdate
Declaration
Swift
public func refreshPrivacySettings()
-
Get the last session disconnect event Triggers ‘SpeedifyLastDisconnectDelegate. Discussion: If the reason happens when closing the tunnel (SUPERCEDED, CONFIGURATIONDISABLED etc.) then the reason will not be updated in the database until the next extension launch. @since 10.4
Declaration
Swift
public func refreshLastDisconnectEvent()
-
Declaration
Swift
public func sessionStatsDidUpdate(stats: Dictionary<String, Any>)
-
- Check if there is already an account using this email address.
@since 7.4
@deprecated as of 15.4. Functionality removed
Declaration
Swift
public func accountCheck(email: String, completionHandler: @escaping (_ error: ErrorType, _ errorMessage: String, _ accountExists: Bool) -> Void)
-
- Resets the tracked data usage on an adapter.
@since 7.8.3
Declaration
Swift
public func resetAdapterUsage(adapterID: String)
-
- Create a new account using this email address.
@since 7.4
@deprecated as of 15.4. Functionality removed
Declaration
Swift
public func accountCreate(email: String, password: String, completionHandler: @escaping (_ error: ErrorType, _ errorMessage: String) -> Void)
-
Request new session stats @since 9.5
Declaration
Swift
public func requestSessionStats()
-
Request the connected server settigns
Declaration
Swift
public func requestServerSettings()
-
Get configuration of streaming settings. Triggers {@link ISpeedifyHandler#OnStreamingSettings OnStreamingSettings}. @since 10.9
Declaration
Swift
public func refreshStreamingSettings()
-
- Change the password on the account.
- @since 7.4
- @deprecated as of 15.4. Functionality removed
Declaration
Swift
public func accountPasswordChange(email: String, originalPassword: String, newPassword: String, completionHandler: @escaping (_ error: ErrorType, _ errorMessage: String) -> Void)
-
- Set ports to be forwarded to this client when connected to a dedicated server.
- Current value available from ‘SpeedifySettingsDelegate’
- @since 8.2
Declaration
Swift
public func setForwardPorts(ports: [ForwardedPort])
-
Set ports to proxy. Triggers LocalProxySettingsDelegate. @param ports ports to be proxied @since 9.9
Declaration
Swift
public func setLocalProxyPorts(ports: [LocalProxyPort])
-
This will cancel an auto connect request.
Declaration
Swift
public func cancelAutoConnect()
-
Requests that Speedify run a speed test to completion. May be cancelled with
stopSpeedTest
. The generated traffic is passed through the TUN device. The daemon (Network Extension), when generating traffic, does not send that traffic through the TUN. The OS prevents us from binding directly to the TUN device. Rather, the UI process can generate traffic for us. @since 11.0Declaration
Swift
@objc public func startSpeedTest()
-
Requests that Speedify run a stream test to completion. See notes under
startSpeedTest
. @since 11.5Declaration
Swift
@objc public func startStreamTest()
-
Requests the daemon to stop the current speed test. Note that this applies to both speed and stream tests. @since 11.0
Declaration
Swift
@objc public func stopSpeedTest()
-
Requests the current speed test results. @since 11.0
Declaration
Swift
@objc public func requestSpeedTestResults()
-
macOS Only. Clear settings from the daemon. This will restart the service if successful.
Declaration
Swift
public func clearSettings(completionHandler: @escaping (_ success: Bool) -> Void)
Parameters
completionHandler
An escaping handler to notifiy a lister of it’s success or failure.
-
@method getExtensionVerisonWithCompletionHandler @discussion This returns the current network extensions
CFBundleShortVersionString
.- @since 10.9
Declaration
Swift
public func getExtensionVerison(completionHandler: @escaping (_ version: String) -> Void)
-
Tells the delegate the current ‘State’.
Declaration
Swift
public func stateDidUpdate(state: State)
-
Tells the delegate the current ‘AdapterData’.
Declaration
Swift
public func adapterDataDidUpdate(adapterData: [AdapterData])
-
Declaration
Swift
public func setCaptivePortalEnable(enable: Bool, network: String)
-
Tells the delegate the current ‘ConnectionStats’.
Declaration
Swift
public func connectionStatsDidUpdate(connectionStats: [ConnectionStats])
-
Tells the delegate the current ‘Settings’.
Declaration
Swift
public func settingsDidUpdate(settings: Settings)
-
Declaration
Swift
@objc public func currentExtensionState() -> NSString
-
Declaration
Swift
@objc public func sendMessageToExtension(message: NSString, useStarscream: Bool = false)
-
Requests that browsers do not use DNS over HTTPS. DoH can interfere with domain-based local proxy, firewall, and streaming settings. @param disable If DoH is requested to be disabled @since 12.2
Declaration
Swift
public func setRequestToDisableDoH(disableDoH: Bool)
-
Sets the ULP reporting inverval in seconds. @param interval: The interval in seconds. @since 12.8
Declaration
Swift
public func setUlpReportIntervalSeconds(interval: UInt32)
-
Speedify follows a backoff pattern for repeated errors when logging in or connecting to VPN servers. With each subsequent failure, the wait time increases before attempting to login or connect again. The backoff’s timeout limit can be set with this call. @param timeout Timeout in seconds @since 14.6
Declaration
Swift
public func setMaximumConnectRetry(timeout: UInt32)
-
When Speedify fails to establish VPN transport connections over an Internet connection, it will use a backoff pattern to wait before attempting to establish a transport over that connection again. This call is used to set that backoff timeout limit. @param timeout Timeout in seconds @since 14.6
Declaration
Swift
public func setMaximumTransportRetry(timeout: UInt32)
-
Generates new ulp data report with feedback message attached @param feedback feedback message @since 14.7
Declaration
Swift
public func sendFeedback(feedback: String)
-
Declaration
Swift
public func sendLogReport(fileUrl: URL, message: String, email: String)
-
Declaration
Swift
@objc public func sendBatteryState()