HTTP 探测改为填写网址,缺本机引擎时立刻失败
HTTP 模式不再单独填端口。完整网址沿用其中的协议、端口和路径;只写主机名或 IP 时按 http 和 80 端口。超时默认改为 5000 毫秒。本机找不到或启动不了 netquality-reflector 时直接说明原因,并建议改用远程节点,不再记成一次全部失败。 Co-authored-by: yanjiu0721 <yanjiu0721@users.noreply.github.com>
This commit is contained in:
1 parent
846e40c023
commit
918ec8f190
20 files changed
+807
-131
No files matched your search
@@ -23,20 +23,29 @@ String portHint(ProbeProfile profile) {
|
||||
return '合作反射 TCP 默认 19090';
|
||||
case 'nq-udp':
|
||||
return '合作反射 UDP 默认 19091';
|
||||
case 'http':
|
||||
return 'HTTP 默认 443(https)或 80(http)';
|
||||
default:
|
||||
return '${profile.label} 默认 ${profile.port}';
|
||||
}
|
||||
}
|
||||
|
||||
/// Default port for an HTTP target. A full http:// URL uses 80. Anything else uses 443.
|
||||
int httpDefaultPort(String target) {
|
||||
final text = target.trim().toLowerCase();
|
||||
if (text.startsWith('http://')) {
|
||||
return 80;
|
||||
const nonHttpTimeoutMs = 1000;
|
||||
const httpTimeoutMs = 5000;
|
||||
|
||||
int timeoutDefaultFor(String profileId) =>
|
||||
profileId == 'http' ? httpTimeoutMs : nonHttpTimeoutMs;
|
||||
|
||||
/// An empty timeout, or one that is still the previous profile's default,
|
||||
/// follows the newly selected profile. A value the user typed stays.
|
||||
String timeoutAfterProfileChange({
|
||||
required String current,
|
||||
required int previousDefault,
|
||||
required int nextDefault,
|
||||
}) {
|
||||
final trimmed = current.trim();
|
||||
if (trimmed.isEmpty || int.tryParse(trimmed) == previousDefault) {
|
||||
return '$nextDefault';
|
||||
}
|
||||
return 443;
|
||||
return current;
|
||||
}
|
||||
|
||||
const portHelperText =
|
||||
|
||||
Reference in new issue
Block a user