sstp_flutter 1.3.0
sstp_flutter: ^1.3.0 copied to clipboard
SstpFlutter is a Flutter plugin for SSTP VPN connections. It provides a convenient way to manage SSTP VPN connections, monitor connection status, and configure various settings.
SstpFlutter #
SstpFlutter is a Flutter plugin for SSTP VPN connections. It provides a convenient way to manage SSTP VPN connections, monitor connection status, and configure various settings.
Features #
- Connect to SSTP VPN server
- Monitor connection status and duration
- Retrieve download and upload speed
- Enable and disable DNS
- Enable and disable proxy
- Save server data for quick connection
- Check the last connection status
- Get installed apps and manage allowed apps
Getting Started #
To use this plugin, add sstp_flutter
as a dependency in your pubspec.yaml
file.
dependencies:
sstp_flutter: ^version
Then, run flutter pub get
to install the dependency.
iOS Setup #
1. Add Capabillity #
Add Network Extensions capabillity on Runner's Target and enable Packet Tunnel

2. Add New Target #
Click + button on bottom left, Choose NETWORK EXTENSION. And set Language and Provider Type to Objective-C and Packet Tunnel as image below.

3. Add Capabillity to sstp_extension #
Repeat the step 1 for new target you created on previous step (sstp_extension)
4. Add Pod dependency #
Open your Podfile , and add the following lines:
target 'sstp_extension' do
pod 'vpn_adapter_ios', :git => 'https://github.com/NavidShokoufeh/vpn_adapter_ios.git', :tag => '1.0.0'
end
And in your runner target do the same :
target 'Runner' do
pod 'vpn_adapter_ios', :git => 'https://github.com/NavidShokoufeh/vpn_adapter_ios.git', :tag => '1.0.0' <-- Add this line
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
5. Copy Paste #
Open sstp_extension > PacketTunnelProvider.m and copy paste this script PacketTunnelProvider.m
Example #
import 'package:sstp_flutter/sstp_flutter.dart';
void main() async {
SstpFlutter sstpFlutter = SstpFlutter();
var cert_dir = "";
// Take VPN permission
await sstpFlutter.takePermission();
// Create an SSTP server object
SSTPServer server = SSTPServer(
host: hostNameController.text,
port: int.parse(sslPortController.text),
username: userNameController.text,
password: passController.text,
androidConfiguration: SSTPAndroidConfiguration(
verifyHostName: false,
useTrustedCert: false,
verifySSLCert: false,
sslVersion: SSLVersions.TLSv1_1,
showDisconnectOnNotification: true,
notificationText: "Notification Text Holder",
),
iosConfiguration: SSTPIOSConfiguration(
enableMSCHAP2: true,
enableCHAP: false,
enablePAP: false,
enableTLS: false,
),
);
// Save created SSTP server
await sstpFlutter.saveServerData(server: server);
// Opens files and then returns selected directory path (Android only)
certDir = await sstpFlutterPlugin.addCertificate();
// Connect to SSTP VPN
await sstpFlutter.connectVpn();
// Monitor connection status
sstpFlutterPlugin.onResult(
onConnectedResult: (ConnectionTraffic traffic, Duration duration) {
setState(() {
connectionTimer = duration;
connectionStatus = "connected";
downSpeed = traffic.downloadTraffic ?? 0;
upSpeed = traffic.uploadTraffic ?? 0;
});
},
onConnectingResult: () {
debugPrint("onConnectingResult");
setState(() {å
connectionStatus = "connecting";
});
},
onDisconnectedResult: () {
debugPrint("onDisconnectedResult");
setState(() {
connectionStatus = "disconnected";
downSpeed = 0;
upSpeed = 0;
});
},
onError: () {});
// Disconnect from SSTP VPN
await sstpFlutter.disconnect();
// Get installed apps (Android only)
List<InstalledAppInfo> installedApps = await sstpFlutter.getInstalledApps();
print('Installed Apps: $installedApps');
// Get allowed apps (Android only)
List<String> allowedApps = await sstpFlutter.getAllowedApps();
print('Allowed Apps: $allowedApps');
// Add apps to allowed apps (Android only)
await sstpFlutter.addToAllowedApps(packages: ['com.example.app']);
// Enable DNS (Android only)
await sstpFlutter.enableDns(DNS: '8.8.8.8');
// Disable DNS (Android only)
await sstpFlutter.disableDNS();
// Enable proxy (Android only)
await sstpFlutter.enableProxy(proxy: SSTPProxy(host: 'proxy.example.com', port: 8080));
// Disable proxy (Android only)
await sstpFlutter.disableProxy();
// Check last connection status
UtilKeys status = await sstpFlutter.checkLastConnectionStatus();
print('Last Connection Status: $status');
}
Please note that the plugin methods may throw exceptions (PlatformException
). Handle them appropriately in your application.
Contributions and Issues #
Feel free to contribute to this project by submitting pull requests or reporting issues on the GitHub repository.
This addition emphasizes that the purpose of the plugin is to provide a secure means for web surfing using SSTP VPN connections. Adjustments can be made based on your specific requirements.
Support this Project #
If you find this project helpful, consider supporting it by making a donation. Major of Your contribution will spend on charity every month.
- Bitcoin (BTC):
bc1qgwfqm5e3fhyw879ycy23zljcxl2pvs575c3j7w
- USDT (TRC20):
TJc5v4ktoFaG3WamjY5rvSZy7v2F6tFuuE
Thank you for your support! 🚀