new: add warp fake packet delay, add warp detour, add new ipinfo api
This commit is contained in:
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -75,7 +75,8 @@ jobs:
|
|||||||
targets: dmg,pkg
|
targets: dmg,pkg
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
if: matrix.platform!='android-aab' || ${{ inputs.upload-artifact && inputs.tag-name != 'draft' }}
|
if: matrix.platform != 'android-aab' || ${{ inputs.upload-artifact && inputs.tag-name != 'draft' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|||||||
@@ -291,7 +291,8 @@
|
|||||||
"warpLicenseKey": "License Key",
|
"warpLicenseKey": "License Key",
|
||||||
"warpCleanIp": "Clean IP",
|
"warpCleanIp": "Clean IP",
|
||||||
"warpPort": "Port",
|
"warpPort": "Port",
|
||||||
"warpNoise": "Noise"
|
"warpNoise": "Noise Count",
|
||||||
|
"warpNoiseDelay": "Noise Delay"
|
||||||
},
|
},
|
||||||
"geoAssets": {
|
"geoAssets": {
|
||||||
"pageTitle": "Routing Assets",
|
"pageTitle": "Routing Assets",
|
||||||
|
|||||||
@@ -77,7 +77,11 @@ class DioHttpClient with InfraLogger {
|
|||||||
url,
|
url,
|
||||||
path,
|
path,
|
||||||
cancelToken: cancelToken,
|
cancelToken: cancelToken,
|
||||||
options: _options(url, userAgent: userAgent, credentials: credentials),
|
options: _options(
|
||||||
|
url,
|
||||||
|
userAgent: userAgent,
|
||||||
|
credentials: credentials,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +108,8 @@ class DioHttpClient with InfraLogger {
|
|||||||
headers: {
|
headers: {
|
||||||
if (userAgent != null) "User-Agent": userAgent,
|
if (userAgent != null) "User-Agent": userAgent,
|
||||||
if (basicAuth != null) "authorization": basicAuth,
|
if (basicAuth != null) "authorization": basicAuth,
|
||||||
|
// "Accept": "application/json",
|
||||||
|
// "Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,8 +66,11 @@ class ConfigOptionEntity with _$ConfigOptionEntity {
|
|||||||
@Default("auto") String warpCleanIp,
|
@Default("auto") String warpCleanIp,
|
||||||
@Default(0) int warpPort,
|
@Default(0) int warpPort,
|
||||||
@OptionalRangeJsonConverter()
|
@OptionalRangeJsonConverter()
|
||||||
@Default(OptionalRange())
|
@Default(OptionalRange(min: 5, max: 10))
|
||||||
OptionalRange warpNoise,
|
OptionalRange warpNoise,
|
||||||
|
@OptionalRangeJsonConverter()
|
||||||
|
@Default(OptionalRange(min: 20, max: 200))
|
||||||
|
OptionalRange warpNoiseDelay,
|
||||||
@Default("") String warpWireguardConfig,
|
@Default("") String warpWireguardConfig,
|
||||||
}) = _ConfigOptionEntity;
|
}) = _ConfigOptionEntity;
|
||||||
|
|
||||||
@@ -141,6 +144,7 @@ class ConfigOptionEntity with _$ConfigOptionEntity {
|
|||||||
warpCleanIp: patch.warpCleanIp ?? warpCleanIp,
|
warpCleanIp: patch.warpCleanIp ?? warpCleanIp,
|
||||||
warpPort: patch.warpPort ?? warpPort,
|
warpPort: patch.warpPort ?? warpPort,
|
||||||
warpNoise: patch.warpNoise ?? warpNoise,
|
warpNoise: patch.warpNoise ?? warpNoise,
|
||||||
|
warpNoiseDelay: patch.warpNoiseDelay ?? warpNoiseDelay,
|
||||||
warpWireguardConfig: patch.warpWireguardConfig ?? warpWireguardConfig,
|
warpWireguardConfig: patch.warpWireguardConfig ?? warpWireguardConfig,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -198,6 +202,7 @@ class ConfigOptionEntity with _$ConfigOptionEntity {
|
|||||||
cleanIp: warpCleanIp,
|
cleanIp: warpCleanIp,
|
||||||
cleanPort: warpPort,
|
cleanPort: warpPort,
|
||||||
warpNoise: warpNoise,
|
warpNoise: warpNoise,
|
||||||
|
warpNoiseDelay: warpNoiseDelay,
|
||||||
wireguardConfig: warpWireguardConfig,
|
wireguardConfig: warpWireguardConfig,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -253,6 +258,7 @@ class ConfigOptionPatch with _$ConfigOptionPatch {
|
|||||||
String? warpCleanIp,
|
String? warpCleanIp,
|
||||||
int? warpPort,
|
int? warpPort,
|
||||||
@OptionalRangeJsonConverter() OptionalRange? warpNoise,
|
@OptionalRangeJsonConverter() OptionalRange? warpNoise,
|
||||||
|
@OptionalRangeJsonConverter() OptionalRange? warpNoiseDelay,
|
||||||
String? warpWireguardConfig,
|
String? warpWireguardConfig,
|
||||||
}) = _ConfigOptionPatch;
|
}) = _ConfigOptionPatch;
|
||||||
|
|
||||||
|
|||||||
@@ -172,6 +172,25 @@ class WarpOptionsTiles extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
title: Text(t.settings.config.warpNoiseDelay),
|
||||||
|
subtitle: Text(options.warpNoiseDelay.present(t)),
|
||||||
|
enabled: canChangeOptions,
|
||||||
|
onTap: () async {
|
||||||
|
final warpNoiseDelay = await SettingsInputDialog(
|
||||||
|
title: t.settings.config.warpNoiseDelay,
|
||||||
|
initialValue: options.warpNoiseDelay.format(),
|
||||||
|
resetValue: defaultOptions.warpNoiseDelay.format(),
|
||||||
|
).show(context);
|
||||||
|
if (warpNoiseDelay == null) return;
|
||||||
|
await onChange(
|
||||||
|
ConfigOptionPatch(
|
||||||
|
warpNoise:
|
||||||
|
OptionalRange.tryParse(warpNoiseDelay, allowEmpty: true),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,8 @@ class ProxyRepositoryImpl
|
|||||||
|
|
||||||
final Map<String, IpInfo Function(Map<String, dynamic> response)>
|
final Map<String, IpInfo Function(Map<String, dynamic> response)>
|
||||||
_ipInfoSources = {
|
_ipInfoSources = {
|
||||||
|
// "https://geolocation-db.com/json/": IpInfo.fromGeolocationDbComJson,
|
||||||
|
"https://api.ip.sb/geoip/": IpInfo.fromIpSbJson,
|
||||||
"https://ipapi.co/json/": IpInfo.fromIpApiCoJson,
|
"https://ipapi.co/json/": IpInfo.fromIpApiCoJson,
|
||||||
"https://ipinfo.io/json/": IpInfo.fromIpInfoIoJson,
|
"https://ipinfo.io/json/": IpInfo.fromIpInfoIoJson,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -67,4 +67,46 @@ class IpInfo with IpInfoMappable {
|
|||||||
_ => throw const FormatException("invalid json"),
|
_ => throw const FormatException("invalid json"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static IpInfo fromIpSbJson(Map<String, dynamic> json) {
|
||||||
|
return switch (json) {
|
||||||
|
{
|
||||||
|
"ip": final String ip,
|
||||||
|
"country_code": final String countryCode,
|
||||||
|
"region": final String region,
|
||||||
|
"city": final String city,
|
||||||
|
"timezone": final String timezone,
|
||||||
|
"asn": final int asn,
|
||||||
|
"asn_organization": final String org,
|
||||||
|
} =>
|
||||||
|
IpInfo(
|
||||||
|
ip: ip,
|
||||||
|
countryCode: countryCode,
|
||||||
|
region: region,
|
||||||
|
city: city,
|
||||||
|
timezone: timezone,
|
||||||
|
asn: '$asn',
|
||||||
|
org: org,
|
||||||
|
),
|
||||||
|
_ => throw const FormatException("invalid json"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static IpInfo fromGeolocationDbComJson(Map<String, dynamic> json) {
|
||||||
|
return switch (json) {
|
||||||
|
{
|
||||||
|
"ip": final String ip,
|
||||||
|
"country_code": final String countryCode,
|
||||||
|
"state": final String region,
|
||||||
|
"city": final String city
|
||||||
|
} =>
|
||||||
|
IpInfo(
|
||||||
|
ip: ip,
|
||||||
|
countryCode: countryCode,
|
||||||
|
region: region,
|
||||||
|
city: city,
|
||||||
|
),
|
||||||
|
_ => throw const FormatException("invalid json"),
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ class SingboxWarpOption with _$SingboxWarpOption {
|
|||||||
required String cleanIp,
|
required String cleanIp,
|
||||||
required int cleanPort,
|
required int cleanPort,
|
||||||
@OptionalRangeJsonConverter() required OptionalRange warpNoise,
|
@OptionalRangeJsonConverter() required OptionalRange warpNoise,
|
||||||
|
@OptionalRangeJsonConverter() required OptionalRange warpNoiseDelay,
|
||||||
}) = _SingboxWarpOption;
|
}) = _SingboxWarpOption;
|
||||||
|
|
||||||
factory SingboxWarpOption.fromJson(Map<String, dynamic> json) =>
|
factory SingboxWarpOption.fromJson(Map<String, dynamic> json) =>
|
||||||
|
|||||||
2
libcore
2
libcore
Submodule libcore updated: 298ca9b1b8...70157d1ac6
Reference in New Issue
Block a user