Skip to content

Commit

Permalink
Use multi-URL config params
Browse files Browse the repository at this point in the history
Instead of deprecated single-URL params. Specifically, using these:
RemoteServerListURLs, ObfuscatedServerListRootURLs, UpgradeDownloadURLs
  • Loading branch information
adam-p committed Apr 26, 2017
1 parent fe7317b commit c131ca8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
9 changes: 4 additions & 5 deletions MobileLibrary/iOS/PsiphonTunnel/PsiphonTunnel/PsiphonTunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ FOUNDATION_EXPORT const unsigned char PsiphonTunnelVersionString[];
- `PropagationChannelId`
- `SponsorId`
- Remote server list functionality is not strictly required, but absence greatly undermines circumvention ability.
- `RemoteServerListUrl`
- `RemoteServerListURLs`
- `RemoteServerListSignaturePublicKey`
- Obfuscated server list functionality is also not strictly required, but aids circumvention ability.
- `ObfuscatedServerListRootURL`
- `ObfuscatedServerListRootURLs`
Optional fields (if you don't need them, don't set them):
- `DataStoreDirectory`: If not set, the library will use a sane location. Override if the client wants to restrict where operational data is kept. If overridden, the directory must already exist and be writable.
Expand All @@ -67,9 +67,9 @@ FOUNDATION_EXPORT const unsigned char PsiphonTunnelVersionString[];
- `EgressRegion`
- `EstablishTunnelTimeoutSeconds`
- Should only be set if the Psiphon library is handling upgrade downloading (which it usually is _not_):
- `UpgradeDownloadUrl`
- `UpgradeDownloadURLs`
- `UpgradeDownloadClientVersionHeader`
- `UpgradeDownloadFilename`
- `UpgradeDownloadFilename`: Will be set to a sane default if not supplied.
- Only set if disabling timeouts (for very slow network connections):
- `TunnelConnectTimeoutSeconds`
- `TunnelPortForwardDialTimeoutSeconds`
Expand All @@ -83,7 +83,6 @@ FOUNDATION_EXPORT const unsigned char PsiphonTunnelVersionString[];
- `LocalHttpProxyPort`
- `LocalSocksProxyPort`
- `TunnelWholeDevice`: For stats purposes, but must be accurate. Defaults to 0 (false).
@endcode
@note All other config fields must not be set.
Expand Down
31 changes: 24 additions & 7 deletions MobileLibrary/iOS/PsiphonTunnel/PsiphonTunnel/PsiphonTunnel.m
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ -(NSString * _Nullable)getConfig {
[self logMessage:[NSString stringWithFormat: @"RemoteServerListDownloadFilename overridden from '%@' to '%@'", defaultRemoteServerListFilename, config[@"RemoteServerListDownloadFilename"]]];
}

// If RemoteServerListUrl and RemoteServerListSignaturePublicKey are absent,
// we'll just leave them out, but we'll log about it.
if (config[@"RemoteServerListUrl"] == nil ||
// If RemoteServerListUrl/RemoteServerListURLs and RemoteServerListSignaturePublicKey
// are absent, we'll just leave them out, but we'll log about it.
if ((config[@"RemoteServerListUrl"] == nil && config[@"RemoteServerListURLs"] == nil) ||
config[@"RemoteServerListSignaturePublicKey"] == nil) {
[self logMessage:@"Remote server list functionality will be disabled"];
}
Expand Down Expand Up @@ -264,11 +264,29 @@ -(NSString * _Nullable)getConfig {
[self logMessage:[NSString stringWithFormat: @"ObfuscatedServerListDownloadDirectory overridden from '%@' to '%@'", [defaultOSLDirectoryURL path], config[@"ObfuscatedServerListDownloadDirectory"]]];
}

// If ObfuscatedServerListRootURL is absent, we'll leave it out, but log the absence.
if (config[@"ObfuscatedServerListRootURL"] == nil) {
// If ObfuscatedServerListRootURL/ObfuscatedServerListRootURLs is absent,
// we'll leave it out, but log the absence.
if (config[@"ObfuscatedServerListRootURL"] == nil && config[@"ObfuscatedServerListRootURLs"] == nil) {
[self logMessage:@"Obfuscated server list functionality will be disabled"];
}

//
// Upgrade Download Filename
//

NSString *defaultUpgradeDownloadFilename = [[libraryURL URLByAppendingPathComponent:@"upgrade_download_file" isDirectory:NO] path];
if (defaultUpgradeDownloadFilename == nil) {
[self logMessage:@"Unable to create defaultUpgradeDownloadFilename"];
return nil;
}

if (config[@"UpgradeDownloadFilename"] == nil) {
config[@"UpgradeDownloadFilename"] = defaultUpgradeDownloadFilename;
}
else {
[self logMessage:[NSString stringWithFormat: @"UpgradeDownloadFilename overridden from '%@' to '%@'", defaultUpgradeDownloadFilename, config[@"UpgradeDownloadFilename"]]];
}

// Other optional fields not being altered. If not set, their defaults will be used:
// * EstablishTunnelTimeoutSeconds
// * TunnelWholeDevice
Expand All @@ -277,9 +295,8 @@ -(NSString * _Nullable)getConfig {
// * UpstreamProxyUrl
// * EmitDiagnosticNotices
// * EgressRegion
// * UpgradeDownloadUrl
// * UpgradeDownloadUrl/UpgradeDownloadURLs
// * UpgradeDownloadClientVersionHeader
// * UpgradeDownloadFilename
// * timeout fields

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ All other values will be provided to you by Psiphon Inc.
"PropagationChannelId": "...",
"SponsorId": "...",
"RemoteServerListSignaturePublicKey": "...",
"RemoteServerListUrl": "..."
"RemoteServerListURLs": "[...]",
"ObfuscatedServerListRootURLs": "[...]",
"EmitDiagnosticNotices": true /* Useful when testing */
}

0 comments on commit c131ca8

Please sign in to comment.