判定按状态码白名单而不是只认 200:探测不带鉴权,OpenAI 回 401、Anthropic 回 405 才是正常应答,说明 TLS 握手、路由、目标服务全都正常。清单和白名单照 sub2api 的 代理质量检查抄来。 失败文案不照抄 Bun:本机端口没人监听时它给的是「Unable to connect. Is the computer able to access the url?」,把矛头指向目标网址,而真正的原因在本机。 对话框留在 InboundDetail 而不是提到 RouterPage——它不写配置文件也不改内核状态, 不需要走那条 commit 链路。firstPort 挪进 shared/inbounds.ts,两个页面都要用它了。
This commit is contained in:
+16
-1
@@ -24,7 +24,8 @@ import {
|
||||
undoConfig,
|
||||
} from './config-store.ts'
|
||||
import { geoStatus, syncGeoFile } from './geo.ts'
|
||||
import { hostInfo, probeExit } from './host.ts'
|
||||
import { hostInfo, probeExit, probeReach } from './host.ts'
|
||||
import { findTarget } from '../shared/reachability.ts'
|
||||
import {
|
||||
kernelVersion,
|
||||
proxyGet,
|
||||
@@ -283,6 +284,20 @@ function makeRoute(env: Env, token: string) {
|
||||
return json(await probeExit(port))
|
||||
}
|
||||
|
||||
// 经由某个入站端口探测一个目标能不能访问。一次一个目标,前端并发发起,
|
||||
// 这样每一行各自落定,不必等最慢的那个才整表出现
|
||||
if (path === '/api/host/reach' && req.method === 'GET') {
|
||||
const port = Number(url.searchParams.get('port'))
|
||||
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
||||
return json({ message: 'port 参数必须是 1-65535 的端口号' }, 400)
|
||||
}
|
||||
const target = findTarget(url.searchParams.get('target') ?? '')
|
||||
if (!target) {
|
||||
return json({ message: `没有名为 ${url.searchParams.get('target') ?? ''} 的探测目标` }, 400)
|
||||
}
|
||||
return json(await probeReach(port, target))
|
||||
}
|
||||
|
||||
// ── 内核 ────────────────────────────────────────────
|
||||
if (path === '/api/kernel' && req.method === 'GET') {
|
||||
return json(await kernelVersion(env))
|
||||
|
||||
Reference in New Issue
Block a user