mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-03-15 04:23:17 +08:00
iOS fix: Stop switching to the background for a long time and then start packet capture without network problem (#146)
This commit is contained in:
@@ -2,7 +2,7 @@ import UIKit
|
||||
import Flutter
|
||||
import NetworkExtension
|
||||
|
||||
@UIApplicationMain
|
||||
@main
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
|
||||
var backgroundAudioEnable: Bool = true
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:network_proxy/network/bin/configuration.dart';
|
||||
import 'package:network_proxy/network/channel.dart';
|
||||
@@ -84,6 +85,16 @@ class ProxyServer {
|
||||
});
|
||||
}
|
||||
|
||||
///检查是否监听端口 没有监听则启动
|
||||
Future<void> startForCheck() async {
|
||||
try {
|
||||
var socket = await Socket.connect('127.0.0.1', port, timeout: const Duration(milliseconds: 100));
|
||||
socket.close();
|
||||
} catch (e) {
|
||||
await start();
|
||||
}
|
||||
}
|
||||
|
||||
/// 停止代理服务
|
||||
Future<Server?> stop() async {
|
||||
if (!isRunning) {
|
||||
@@ -115,7 +126,7 @@ class ProxyServer {
|
||||
|
||||
/// 重启代理服务
|
||||
Future<void> restart() async {
|
||||
await stop().then((value) => start());
|
||||
await stop().whenComplete(() => start());
|
||||
}
|
||||
|
||||
///添加监听器
|
||||
|
||||
@@ -119,27 +119,22 @@ class _DesktopHomePagePageState extends State<DesktopHomePage> implements EventL
|
||||
},
|
||||
child: Text(localizations.cancel))
|
||||
],
|
||||
title: Text(isCN ? '更新内容V1.1.1' : "Update content V1.1.1", style: const TextStyle(fontSize: 18)),
|
||||
title: Text(isCN ? '更新内容V1.1.2' : "Update content V1.1.2", style: const TextStyle(fontSize: 18)),
|
||||
content: Text(
|
||||
isCN
|
||||
? '提示:默认不会开启HTTPS抓包,请安装证书后再开启HTTPS抓包。\n'
|
||||
'点击HTTPS抓包(加锁图标),选择安装根证书,按照提示操作即可。\n\n'
|
||||
'1. 支持导入自定义跟证书,以及生成自定义根证书;\n'
|
||||
'2. 支持重新生成根证书,以及重置默认跟证书;\n'
|
||||
'3. 支持导出根证书(p12)和私钥;\n'
|
||||
'4. 历史记录支持重放所有请求;\n'
|
||||
'5. 重放域名下请求;\n'
|
||||
'6. 修复请求重写列表换行问题;\n'
|
||||
'7. 脚本headers支持同名多个值情况;\n'
|
||||
'1. iOS 通知栏显示VPN状态;\n'
|
||||
'2. iOS修复停止长时间切换后台再开启抓包无网络问题;\n'
|
||||
'3. 修复请求重发和脚本导致URL错误;\n'
|
||||
'4. 修复脚本二进制body转换问题;\n'
|
||||
'5. 修复请求编辑中文路径编码问题;\n'
|
||||
: 'Tips:By default, HTTPS packet capture will not be enabled. Please install the certificate before enabling HTTPS packet capture。\n'
|
||||
'Click HTTPS Capture packets(Lock icon),Choose to install the root certificate and follow the prompts to proceed。\n\n'
|
||||
'1. Support importing custom certificates and generating custom root certificates;\n'
|
||||
'2. Support generate new root certificates and resetting default root certificates;\n'
|
||||
'3. Support exporting root certificates and private keys;\n'
|
||||
'4. History supports replaying all requests;\n'
|
||||
'5. Replay domain name request;\n'
|
||||
'6. Fix request rewrite list word wrapping;\n'
|
||||
'7. Script headers support multiple values with the same name;\n'
|
||||
'1. iOS notification bar displays VPN status;\n'
|
||||
'2. iOS fix: Stop switching to the background for a long time and then start packet capture without network problem;\n'
|
||||
'3. fix request repeat & script change url wrong;\n'
|
||||
'4. fix script binary body convert;\n'
|
||||
'',
|
||||
style: const TextStyle(fontSize: 14)));
|
||||
});
|
||||
|
||||
@@ -207,6 +207,11 @@ class MobileHomeState extends State<MobileHomePage> implements EventListener, Li
|
||||
startup: proxyServer.configuration.startup,
|
||||
serverLaunch: false,
|
||||
onStart: () async {
|
||||
//ios端口可能会被系统杀掉
|
||||
if (Platform.isIOS) {
|
||||
await proxyServer.restart();
|
||||
}
|
||||
|
||||
Vpn.startVpn(
|
||||
Platform.isAndroid ? await localIp() : "127.0.0.1", proxyServer.port, proxyServer.configuration);
|
||||
},
|
||||
@@ -219,21 +224,19 @@ class MobileHomeState extends State<MobileHomePage> implements EventListener, Li
|
||||
|
||||
String content = isCN
|
||||
? '提示:默认不会开启HTTPS抓包,请安装证书后再开启HTTPS抓包。\n\n'
|
||||
'1. 支持导入自定义跟证书,以及生成自定义根证书;\n'
|
||||
'2. 支持重新生成根证书,以及重置默认跟证书;\n'
|
||||
'3. 支持导出根证书(P12)和私钥;\n'
|
||||
'4. 重放域名下请求;\n'
|
||||
'5. 修复请求重写列表换行问题;\n'
|
||||
'6. 脚本headers支持同名多个值情况;\n'
|
||||
'1. iOS 通知栏显示VPN状态;\n'
|
||||
'2. iOS修复停止长时间切换后台再开启抓包无网络问题;\n'
|
||||
'3. 修复请求重发和脚本导致URL错误;\n'
|
||||
'4. 修复脚本二进制body转换问题;\n'
|
||||
'5. 修复请求编辑中文路径编码问题;\n'
|
||||
: 'Tips:By default, HTTPS packet capture will not be enabled. Please install the certificate before enabling HTTPS packet capture。\n\n'
|
||||
'Click HTTPS Capture packets(Lock icon),Choose to install the root certificate and follow the prompts to proceed。\n\n'
|
||||
'1. Support importing custom certificates and generating custom root certificates;\n'
|
||||
'2. Support generate new root certificates and resetting default root certificates;\n'
|
||||
'3. Support exporting root certificates(P12) and private keys;\n'
|
||||
'4. Replay domain name request;\n'
|
||||
'5. Fix request rewrite list word wrapping;\n'
|
||||
'6. Script headers support multiple values with the same name;\n';
|
||||
showAlertDialog(isCN ? '更新内容V1.1.1' : "Update content V1.1.1", content, () {
|
||||
'1. iOS notification bar displays VPN status;\n'
|
||||
'2. iOS fix: Stop switching to the background for a long time and then start packet capture without network problem;\n'
|
||||
'3. fix request repeat & script change url wrong;\n'
|
||||
'4. fix script binary body convert;\n'
|
||||
'';
|
||||
showAlertDialog(isCN ? '更新内容V1.1.2' : "Update content V1.1.2", content, () {
|
||||
widget.appConfiguration.upgradeNoticeV10 = false;
|
||||
widget.appConfiguration.flushConfig();
|
||||
});
|
||||
|
||||
@@ -238,7 +238,7 @@ class RequestSequenceState extends State<RequestSequence> with AutomaticKeepAliv
|
||||
//防止频繁刷新
|
||||
if (!changing) {
|
||||
changing = true;
|
||||
Future.delayed(const Duration(milliseconds: 50), () {
|
||||
Future.delayed(const Duration(milliseconds: 150), () {
|
||||
setState(() {
|
||||
changing = false;
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ class About extends StatelessWidget {
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
child: Text(isCN ? "全平台开源免费抓包软件" : "Full platform open source free capture HTTP(S) traffic software")),
|
||||
const SizedBox(height: 10),
|
||||
const Text("V1.1.1"),
|
||||
const Text("V1.1.2"),
|
||||
ListTile(
|
||||
title: const Text("Github"),
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
pwd
|
||||
cd ../build/linux/x64/release
|
||||
rm -rf package
|
||||
mkdir -p package/DEBIAN
|
||||
echo "Package: ProxyPin" >> package/DEBIAN/control
|
||||
echo "Version: 1.1.1" >> package/DEBIAN/control
|
||||
echo "Version: 1.1.2" >> package/DEBIAN/control
|
||||
echo "Priority: optional" >> package/DEBIAN/control
|
||||
echo "Architecture: amd64" >> package/DEBIAN/control
|
||||
echo "Depends: ca-certificates" >> package/DEBIAN/control
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Cocoa
|
||||
import FlutterMacOS
|
||||
|
||||
@NSApplicationMain
|
||||
@main
|
||||
class AppDelegate: FlutterAppDelegate {
|
||||
|
||||
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
||||
|
||||
10
pubspec.yaml
10
pubspec.yaml
@@ -2,7 +2,7 @@ name: network_proxy
|
||||
description: ProxyPin
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
version: 1.1.1+11
|
||||
version: 1.1.2+11
|
||||
|
||||
environment:
|
||||
sdk: '>=3.0.2 <4.0.0'
|
||||
@@ -18,12 +18,12 @@ dependencies:
|
||||
basic_utils: ^5.7.0
|
||||
logger: ^2.0.1
|
||||
date_format: ^2.0.7
|
||||
window_manager: ^0.3.8
|
||||
window_manager: ^0.4.0
|
||||
desktop_multi_window:
|
||||
git:
|
||||
url: https://gitee.com/wanghongenpin/flutter-plugins.git
|
||||
path: packages/desktop_multi_window
|
||||
path_provider: ^2.1.3
|
||||
path_provider: ^2.1.4
|
||||
url_launcher: ^6.3.0
|
||||
proxy_manager: ^0.0.3
|
||||
qr_flutter: ^4.1.0
|
||||
@@ -36,11 +36,11 @@ dependencies:
|
||||
file_selector: ^1.0.3
|
||||
flutter_js: ^0.8.1
|
||||
flutter_code_editor: ^0.3.2
|
||||
file_picker: ^8.0.5
|
||||
file_picker: ^8.0.7
|
||||
flutter_desktop_context_menu: ^0.2.0
|
||||
win32audio: ^1.3.1
|
||||
device_info_plus: ^10.1.1
|
||||
shared_preferences: ^2.2.3
|
||||
shared_preferences: ^2.3.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user