|
1 | 1 | import 'dart:async'; |
2 | | -import 'dart:developer' as dev; |
| 2 | +import 'dart:developer'; |
3 | 3 | import 'package:flutter/material.dart'; |
4 | 4 | import 'package:vpn_client/design/colors.dart'; |
5 | 5 | import 'package:vpn_client/design/dimensions.dart'; |
@@ -148,18 +148,34 @@ class MainBtnState extends State<MainBtn> with SingleTickerProviderStateMixin { |
148 | 148 | // Disconnect |
149 | 149 | ///flutterV2ray.stopV2Ray(); |
150 | 150 |
|
151 | | - /// |
| 151 | +// Get Server Delay |
| 152 | +log('${flutterV2ray.getServerDelay(config: parser.getFullConfiguration())}ms'); |
| 153 | + |
| 154 | +// Permission is not required if you using proxy only |
| 155 | +if (await flutterV2ray.requestPermission()){ |
| 156 | + flutterV2ray.startV2Ray( |
| 157 | + remark: parser.remark, |
| 158 | + // The use of parser.getFullConfiguration() is not mandatory, |
| 159 | + // and you can enter the desired V2Ray configuration in JSON format |
| 160 | + config: parser.getFullConfiguration(), |
| 161 | + blockedApps: null, |
| 162 | + bypassSubnets: null, |
| 163 | + proxyOnly: false, |
| 164 | + ); |
| 165 | +} |
| 166 | + |
| 167 | +// Disconnect |
| 168 | +///flutterV2ray.stopV2Ray(); |
| 169 | +
|
| 170 | +/// |
152 | 171 |
|
153 | 172 | //TODO:move to right place |
154 | 173 | // ======= |
155 | 174 | // |
156 | 175 | // >>>>>>> Stashed changes |
157 | 176 | VPNclientEngine.pingServer(subscriptionIndex: 0, index: 1); |
158 | 177 | VPNclientEngine.onPingResult.listen((result) { |
159 | | - dev.log( |
160 | | - "Ping result: ${result.latencyInMs} ms", |
161 | | - name: 'PingLogger', |
162 | | - ); // <- Use dev.log instead of print.(It build to log meta data) |
| 178 | + log("Ping result: ${result.latencyInMs} ms"); |
163 | 179 | }); |
164 | 180 |
|
165 | 181 | ///final result = await platform.invokeMethod('startVPN'); |
|
0 commit comments