Refactor OpenVPN and OpenConnect endpoints

This commit is contained in:
世界
2026-08-30 17:41:43 +08:00
parent b02ec478c5
commit 6269e1c2b3
25 changed files with 758 additions and 182 deletions
@@ -69,14 +69,15 @@
"route_metric": 0,
"redirect_gateway": false,
"redirect_gateway_flags": [],
"keepalive_interval": "",
"keepalive_timeout": "",
"ping_interval": "",
"ping_restart": "",
"renegotiate_interval": "",
"explicit_exit_notify": 0,
"system": false,
"name": "",
"mtu": 1500,
"udp_timeout": "",
... // UDP NAT 字段
... // 拨号字段
}
@@ -342,7 +343,7 @@ OpenVPN UDP packet 的最大大小,用于限制通过隧道发送的 TCP 连
这可以避免 TCP packet 在 OpenVPN 封装后超过 path MTU。
设为 `0` 时禁用。
为空时使用上游 OpenVPN 默认值:配置了 `fragment` 时使用其值;否则默认 tunnel MTU 使用 `1492`,自定义 tunnel MTU 使用该 MTU。
### fragment
@@ -378,9 +379,10 @@ Compression 可能削弱流量机密性。仅在服务器要求时启用。
### route_no_pull
忽略服务器推送的 route、route gateway 和 redirect-gateway 选项。
忽略服务器推送的 route、DNS 和 DHCP 设置、route metric、`redirect-gateway`、
`redirect-private`、`block-ipv6` 和 `block-outside-dns`。
仍会接受其他推送选项,并继续使用本地配置的 `routes`。
仍会使用接口配置、topology、tunnel MTU、`route-gateway` 和本地配置的 route。
默认禁用。
@@ -388,7 +390,7 @@ Compression 可能削弱流量机密性。仅在服务器要求时启用。
服务器推送选项的有序 pull filter 列表。
应用第一个 `text` 为完整推送选项大小写不敏感前缀的 filter。未匹配任何 filter 的选项会被接受。
应用第一个 `text` 为完整推送选项大小写敏感前缀的 filter。未匹配任何 filter 的选项会被接受。
### pull_filters.action
@@ -402,7 +404,7 @@ Filter action,可选值为 `accept`、`ignore` 或 `reject`。
==必填==
用于匹配推送选项名称和值的大小写不敏感前缀。
用于匹配推送选项名称和值的大小写敏感前缀。
例如,`route ` 会匹配推送的 IPv4 route 选项,但不会匹配 `route-gateway`。
@@ -438,33 +440,37 @@ OpenVPN `redirect-gateway` flag。
默认为空。
### keepalive_interval
### ping_interval
发送 OpenVPN keepalive ping packet 的间隔。
客户端未向服务器发送任何 packet 时,发送 data channel ping 的间隔。
本地配置值优先于服务器推送的 keepalive 值。
服务器推送的 OpenVPN `ping` 值优先于该值。
该值必须使用整秒。
默认禁用。
### keepalive_timeout
### ping_restart
未接收 OpenVPN 流量后重新启动连接的时间。
客户端未收到任何 packet 后重新连接服务器的时间。
本地配置值优先于服务器推送的 keepalive 值。
服务器推送的 OpenVPN `ping-restart` 值优先于该值。
默认禁用。
该值必须使用整秒。
为空时,启用了 pull 的 UDP 连接会使用 `120s`,直到服务器推送其他值。TCP 不使用默认接收超时。
### renegotiate_interval
OpenVPN TLS 重新协商间隔。
如果为空或设为 `0s`,使用 OpenVPN 默认值 `1h`。
为空时使用 OpenVPN 默认值 `1h`。
### explicit_exit_notify
关闭 UDP 连接时发送的 OpenVPN exit notification 数量。
设为 `0` 时禁用。最多发送 `10` 个 notification。
Notification 之间间隔一秒。设为 `0` 时禁用。
### system
@@ -486,11 +492,9 @@ OpenVPN 接口 MTU。
为空时使用服务器推送的 MTU;收到服务器配置前使用 `1500`。
### udp_timeout
## UDP NAT 字段
UDP NAT 过期时间。
默认使用 `5m`。
参阅 [UDP NAT 字段](/zh/configuration/shared/udp-nat/)。
## 拨号字段