Repository navigation
Expand file tree
/
Copy pathfull_config_example.toml
More file actions
164 lines (149 loc) · 7.57 KB
/
Copy pathfull_config_example.toml
File metadata and controls
164 lines (149 loc) · 7.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# 完整的项目配置样例
# 独立 UDP DNS 服务配置(可选,常与 TPROXY 配合使用)
# [dns]
# endpoint = "[::]:53" # 支持 IPv4/IPv6 双栈监听
# router = "main_router" # 复用下面定义的路由器规则选择上游 DNS 服务器、进行 IP->域名学习,并按上游 DNS 服务器 IP 路由请求
# default_servers = ["1.1.1.1:53", "8.8.8.8:53"] # 默认上游 UDP DNS(未被 connector.dns 覆盖时使用)
# stale_while_revalidate = false # 默认关闭;开启后本地缓存不再按原 TTL/短宽限期淘汰(仅在超长时间未访问后按 cache_idle_evict_secs 释放内存),过期请求直接复用缓存并触发带重试的异步后台刷新
# cache_idle_evict_secs = 86400 # stale_while_revalidate 开启时,连续未访问超过该秒数才淘汰释放内存(默认 86400)
# cache_refresh_retries = 3 # stale_while_revalidate 开启时,异步刷新失败后的最大重试次数(默认 3)
# bootstrap_servers = ["114.114.114.114:53", "223.5.5.5:53"] # 可选:直连解析代理节点自身域名使用的 DNS
# disable_aaaa = false # 是否屏蔽 AAAA 查询(返回空 NOERROR)
# suppress_ipv6_ra = true # 是否自动压制主路由向旁路由活跃客户端下发的 IPv6 RA / RDNSS(默认开启)
# suppress_ipv6_ra_ttl_secs = 300 # 旁路由活跃客户端保持 RA 压制的无流量过期时长(秒,默认 300)
# ebpf_direct_offload = true # 是否开启 eBPF TC 内核态 Direct 直连快路旁路(默认开启)
# ebpf_direct_connectors = ["direct"] # 可选:显式指定由 eBPF 接管直连快路的 connector 名称列表;未配置时默认接管所有 proto = "tcp" 的 connector
# upstream_timeout_ms = 2000
# request_timeout_ms = 6000
# 监听器配置
[[listener]]
name = "socks5_inbound"
endpoint = "127.0.0.1:1080"
proto = "socks5"
router = "main_router" # 引用下面定义的路由器
# TPROXY 透明代理监听器配置示例(仅限 Linux)
# 每份配置最多一个 TPROXY 监听器;TCP 和 UDP 使用 mode = "tcp+udp" 合并。
# 配套内核规则与策略路由请通过 systemd 的 ExecStartPre=+/etc/rog/tproxy-up.sh 与 ExecStopPost=+/etc/rog/tproxy-down.sh 管理:
# scripts/tproxy-up.sh 默认自动探测默认路由网卡 (ROG_IFACE)、本机 IPv4 (ROG_IPV4)、局域网 CIDR (ROG_LAN_CIDR) 与 IPv6 前缀,全机器通用。
# 如需自定义可通过环境变量覆盖:ROG_IFACE / ROG_IPV4 / ROG_LAN_CIDR / ROG_DNS_PORT / ROG_USER / ROG_GROUP / ROG_BYPASS_IPV4
# [[listener]]
# name = "tproxy_inbound"
# endpoint = "[::]:12345" # 或单栈 IPv4 "0.0.0.0:12345"
# proto = "tproxy"
# router = "main_router"
# [listener.options]
# mode = "tcp+udp" # 支持 "tcp+udp"(默认)、"tcp"、"udp"
# udp_idle_timeout_secs = 60 # UDP 会话空闲清理时长(秒)
# udp_max_senders = 512 # 伪装回包套接字 LRU 缓存容量上限
# sniff = "ambiguous" # TPROXY TCP(TLS SNI / HTTP Host) + UDP(QUIC Initial SNI) 首包嗅探模式:"ambiguous"(仅共用冲突 IP / exclude IP / 无 DNS 映射时嗅探,默认)、"always"(所有嗅探端口都嗅探)、"off"
# sniff_timeout_ms = 100 # 首包嗅探最长等待毫秒数(超时立刻回退原 IP 路由,避免阻塞 server-first 协议)
# sniff_ports = [80, 443, 8443] # 触发嗅探的目标端口列表
# sniff_override_destination = false # 默认不改写目标 IP,仅用嗅探域名做路由决策与 Observe site 展示
# 连接器配置
# 注:当启用了 [dns] 时:
# - connector.dns 未配置时自动回退使用 dns.default_servers;
# - connector.dns / dns.default_servers / dns.bootstrap_servers / bootstrap_dns 中可使用占位符 "system"(或 "$system")自动读取本机系统默认 DNS(自动跳过回环及自身监听地址);
# - connector.options.bootstrap_dns 未配置时按 dns.bootstrap_servers -> connector.dns -> dns.default_servers 顺序自动回退。
[[connector]]
name = "direct"
proto = "tcp"
dns = ["system", "223.5.5.5:53"] # 使用本机默认 DNS(如路由器 DHCP 下发的 DNS),223.5.5.5 作兜底
# endpoint = "example.com:80" # 可选,如果需要固定连接到某个端点
[[connector]]
name = "proxy_outbound"
proto = "socks5"
endpoint = "127.0.0.1:1081" # 代理服务器地址(未指定 dns 时自动继承 dns.default_servers)
# ipv6 = true # 默认 true;若该出口节点不支持公网 IPv6 可设为 false,DNS 层将自动对路由到该节点的域名屏蔽 AAAA 及 HTTPS ipv6hint
# gRPC / rev_grpc / h3 推荐传输配置,可放在 proto = "grpc" / "h3" 的 listener/connector
# 或 reverse_server.options / proto = "rev_grpc" 的 listener 上。
# [listener.options]
# keep_alive = true
# keep_alive_interval_secs = 30
# keep_alive_timeout_secs = 20
# keep_alive_while_idle = true
# max_idle_timeout_secs = 90 # QUIC/H3 空闲超时(秒,默认 60)
# connect_timeout_secs = 10
# tcp_nodelay = true
# tcp_keepalive_secs = 60
# tcp_keepalive_interval_secs = 20
# tcp_keepalive_retries = 3
# initial_stream_window_size = "8m"
# initial_connection_window_size = "16m"
# stream_channel_size = 64
# channel_buffer_size = 1024
# max_decoding_message_size = "8m"
# max_encoding_message_size = "8m"
# max_concurrent_streams = 256
# concurrency_limit = 256
# concurrency_limit_per_connection = 256
# connections = 2 # H3 connector 连接池并发连接数(默认 2,移动端建议 1)
# fallback_h2 = true # H3 connector QUIC 失败时是否自动回退 HTTP/2 over TLS(如需跳过 QUIC 直接用 H2 over TLS,可将 endpoint 写为 h2://...)
# congestion_control = "bbr" # H3 connector 拥塞控制("bbr" 默认,或 "cubic")
# 路由数据配置
# 这些数据可以在路由规则中被引用
[[data]]
name = "lan_ips"
format = "cidr"
# 可以选择从 url 加载数据,例如:
# url = "file:///path/to/your/ip_list.txt"
# url = "http://example.com/ip_list.txt"
# 也可以直接内嵌数据,每行一个条目
data = """
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
127.0.0.0/8
"""
[[data]]
name = "blocked_sites"
format = "regex"
data = """
.*\\.facebook\\.com
.*\\.twitter\\.com
"""
# 域名后缀匹配示例(支持从 http/https/file url 或内嵌数据加载)
[[data]]
name = "custom_domain_suffixes"
format = "domain-suffix" # 可选: "domain-suffix", "domain_suffix", "suffix"
# url = "http://example.com/suffix.txt#interval=3600" # 支持通过 #interval=秒数 或下方 interval 字段指定刷新间隔
# interval = 3600 # 可选:定期刷新间隔秒数(默认 3600 秒,完全非阻塞后台定时更新)
data = """
google.com
baidu.com
"""
# 域名关键字匹配示例
[[data]]
name = "custom_domain_keywords"
format = "domain-keyword" # 可选: "domain-keyword", "domain_keyword", "keyword"
# url = "http://example.com/keyword.txt"
# interval = 3600
data = """
twitter
github
"""
# 路由器配置
[[router]]
name = "main_router" # 路由器名称,在 listener 中引用
default = "proxy_outbound" # 默认使用的连接器标签
# 路由规则,按顺序匹配
[[router.route_rules]]
# 规则名称,对应上面 data 中的 name
name = "lan_ips"
# 匹配成功后选择的连接器标签
select = "direct"
# 可选:排除规则,例如不匹配某个IP或域名
# exclude = ["192.168.1.1"]
# 可选:是否将域名解析为IP进行匹配
# domain_to_ip = true
# 可选:指定使用的DNS服务器
# dns = "8.8.8.8:53"
[[router.route_rules]]
name = "custom_domain_suffixes"
select = "proxy_outbound"
[[router.route_rules]]
name = "custom_domain_keywords"
select = "proxy_outbound"
[[router.route_rules]]
name = "blocked_sites"
select = "block" # 假设有一个名为 "block" 的连接器或特殊处理方式
domain_to_ip = true # 对于域名规则,通常需要解析IP进行匹配