Skip to content

Observatory

observatory 块对一组出站定期发起探测请求来测量延迟。结果会被 负载均衡器的 strategy: leastPing 使用,让它始终选择最快可达的 出站。

选项

字段类型默认值允许值描述
subjectSelector[]string[]<outbound tag prefix>要探测的出站 tag。每条都是前缀;tag 以列表中任一字符串开头的出站都会被探测。
probeURLstring(required)<URL>探测器在每个被测出站上发起的 URL 请求。延迟以该请求的端到端时长计。
probeIntervalduration.Duration10m<duration>同一出站两次探测之间的等待时间。接受 Go 风格的时长字符串,如 "30s"、"5m"。
enableConcurrencyboolfalsetrue | false对所选出站并发探测而非顺序探测。

源码: infra/conf/observatory.go:12-17 · 锚定版本 v26.6.1 (94ffd50)

示例

json
{
  "outbounds": [
    { "tag": "proxy-jp", "protocol": "vless" },
    { "tag": "proxy-us", "protocol": "vless" }
  ],
  "observatory": {
    "subjectSelector": ["proxy-"],
    "probeURL": "http://www.google.com/generate_204",
    "probeInterval": "30s",
    "enableConcurrency": true
  },
  "routing": {
    "balancers": [
      { "tag": "balancer", "selector": ["proxy-"], "strategy": { "type": "leastPing" } }
    ]
  }
}

说明

  • selector 走 前缀匹配 —— "proxy-" 覆盖 "proxy-jp""proxy-us" 等。空字符串会探测所有出站(多数情况下并不想要)。
  • 需要更快的并发探测且具备 HTTP/2 往返感知能力时,请参考 burstObservatory

源码: infra/conf/observatory.go:12-17 · v26.6.1 (94ffd50)

由 Argsment 出品的 Core Tutorial