/ip/proxy/direct
direct
Rules that decide which requests go directly to the server when a parent proxy is set with parent-proxy and parent-proxy-port in /ip/proxy. The proxy checks the rules from top to bottom, and the first matching rule...
ip/proxy/direct
Type: Directory
当通过 /ip/proxy 中的 parent-proxy 和 parent-proxy-port 设置父代理时,决定哪些请求直接发往服务器的规则。代理从上到下检查规则,由第一条匹配的规则决定。未匹配任何规则的请求会通过父代理发送。没有父代理时,每个请求都直接发往服务器,该列表不起作用。匹配器的工作方式与 /ip/proxy/access 相同。在匹配器值前加 ! 可对其进行否定,例如 src-address=!192.168.88.0/24。示例请参阅 Web 代理。
| 标志 | 名称 | 描述 |
|---|---|---|
X | disabled | 已禁用。该规则未被使用。新规则创建时处于启用状态。 |
| 参数 | 类型 | 描述 |
|---|---|---|
src-address | super { ! , range: alt { ip4: ipRange , ip6: ip6Prefix } } | 客户端的地址:IPv4 地址、范围或前缀,或 IPv6 前缀。 |
dst-address | super { ! , range: alt { ip4: ipRange , ip6: ip6Prefix } } | 代理连接到的服务器地址,即请求中主机名解析后的地址。格式与 src-address 相同。 |
dst-port | super { ! , ports: multi { ports: range [ .. 65535] } } | 服务器端口,对于 HTTPS 请求是 CONNECT 隧道的端口。可以是端口、范围或逗号分隔的列表,例如 dst-port=!443。 |
local-port | super { ! , port: num [0 .. 65535] } | 请求到达代理时使用的端口。当 /ip/proxy 中的 port 列出多个端口时使用。 |
dst-host | super { ! , host: string } | 请求的主机名;对于 HTTPS 请求,为 CONNECT 隧道的主机。值必须匹配完整名称,且不区分大小写,因此 example.com 不匹配 www.example.com。 - 通配符:* 匹配任意字符,? 匹配一个字符,例如 *.example.com。 - 以 : 开头的值是正则表达式,可以匹配名称的任意部分::mail 匹配 mail.example.com。使用 ^ 和 $ 进行锚定,例如 :^www。 |
path | super { ! , path: string } | 请求 URL 的路径,包括查询字符串,例如 /music/a.mp3?x=1。通配符和正则表达式的工作方式与 dst-host 相同。 - 通配符必须匹配包括查询字符串在内的整个路径,因此 *.mp3 匹配 /music/a.mp3,但不匹配 /music/a.mp3?x=1。 - 路径始终以 / 开头,因此路由器会拒绝诸如 music/* 这样永远无法匹配的值。 - HTTPS 请求没有路径,因此带有 path 的规则永远不会匹配它们。 |
method | super { ! , method: enum (GET | HEAD | POST | PUT | CONNECT | OPTIONS | DELETE | TRACE) } | 请求的 HTTP 方法:GET、HEAD、POST、PUT、CONNECT、OPTIONS、DELETE 或 TRACE。代理客户端使用 CONNECT 请求 HTTPS 页面。这些方法定义于 RFC 9110。 |
action | enum (allow | deny) | 代理如何发送匹配的请求。 - allow(默认)- 直接连接到服务器。 - deny - 通过父代理发送请求。 |
| 只读参数 | 类型 | 描述 |
|---|---|---|
hits | num | 规则匹配的请求数。可使用 reset-counters 或 reset-counters-all 重置。 |