start method
Future<ProxyInfo>
start({
- required String psiphonConfig,
- String localAddress = '127.0.0.1:0',
- Duration timeout = const Duration(seconds: 60),
- String? dataRootDirectory,
override
Connects a Psiphon tunnel and runs a local HTTP proxy in front of it.
See PsiphonMobileproxy.start for what each parameter means.
Implementation
@override
Future<ProxyInfo> start({
required String psiphonConfig,
String localAddress = '127.0.0.1:0',
Duration timeout = const Duration(seconds: 60),
String? dataRootDirectory,
}) async {
try {
final address = await methodChannel.invokeMethod<String>('start', {
'psiphonConfig': psiphonConfig,
'localAddress': localAddress,
// The native layer works in whole seconds, since that is what the Go
// bindings accept. Round up so that a sub-second Duration doesn't
// silently become "no timeout".
'timeoutSeconds': _wholeSecondsRoundedUp(timeout),
'dataRootDirectory': dataRootDirectory,
});
return ProxyInfo.fromAddress(address!);
} on PlatformException catch (e) {
throw _mapException(e);
}
}