跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[宽带症候群] 终极的科学方案,还得是 fakeip 网关+mosdns,体验极好。

发表于
原理: https://blog.03k.org/post/paopaogateway.html
这里说的终极,是指体验,影响体验的因素,主要有以下几方面。
1:分流正确、精确,国外的域名代理访问,国内的域名直连访问,不进代理核心。
2:根据域名分流,而不是根据 ip 分流。

dns 分流逻辑
1:国内域名列表直接向 223.5.5.5 请求,发 realip
2:国外域名列表向 sing-box/mihomo 请求 fakeip
3:不在域名列表中的域名,带 ecs 向 8888 请求,如果返回中国 ip 就采用,如果返回非中国 IP ,则抛弃,再次向 sing-box/mihomo 请求 fakeip 。

策略路由与 iptables 操作,只处理需要代理的 IP 段
#fakeip 段
ip route add local 28.0.0.0/8 dev lo table 100
#公共 dns ip 段
ip route add local 8.8.8.8/32 dev lo table 100
#电报、奈飞等 IP 直连的 IP 段
ip route add local 23.23.189.144/28 dev lo table 100
ip rule add fwmark 1 table 100
#电报、奈飞等 IP 直连的 IP 段
ip -6 route add local 2001:b28:f23d::/48 dev lo table 200
ip -6 rule add fwmark 1 table 200

iptables 操作,只劫持需要代理的 IP 段
iptables -t mangle -N SING_BOX
ip6tables -t mangle -N SING_BOX_V6
iptables -t mangle -A SING_BOX -p tcp -j TPROXY --tproxy-mark 1 --on-ip 127.0.0.1 --on-port 7895
iptables -t mangle -A SING_BOX -p udp -j TPROXY --tproxy-mark 1 --on-ip 127.0.0.1 --on-port 7895
ip6tables -t mangle -A SING_BOX_V6 -p tcp -j TPROXY --on-port 7895 --on-ip ::1 --tproxy-mark 1
ip6tables -t mangle -A SING_BOX_V6 -p udp -j TPROXY --on-port 7895 --on-ip ::1 --tproxy-mark 1
iptables -t mangle -A PREROUTING -m set --match-set singboxset dst -j SING_BOX
ip6tables -t mangle -A PREROUTING -m set --match-set singboxset6 dst -j SING_BOX_V6


mosdns 代码示例
- tag: main_sequence
type: sequence
args:
- matches: qname $blocklist 如果是黑名单域名
exec: reject 0 屏蔽,流程结束
- matches: "!qtype 1 16 28" 如果不是 A 和 TXT 类型的 dns 请求 (只允许 A 、AAAA 、TXT 记录)
exec: reject 0 屏蔽,流程结束
- matches: "qname $geosite_apple" 如果是苹果域名
exec: $forward_local 发送到国内 dns
- matches: has_resp 如果有结果
exec: accept 流程结束
- matches: qname $whitelist 如果是白名单域名
exec: $forward_local 发送到国内 dns
- matches: has_resp 如果有结果
exec: accept 流程结束
- matches: qname $greylist 如果是灰名单域名
exec: $forward_remote 发送到 sing-box dns 请求 fakeip
- matches: has_resp 如果有结果
exec: accept 流程结束
- matches: qname $geosite_cn 如果是国内列表的域名
exec: $forward_local 发送到国内 dns
- matches: has_resp 如果有结果
exec: accept 流程结束
- matches: qname $geosite_no_cn 如果是国外列表的域名
exec: $forward_remote 发送到 sing-box dns 请求 fakeip
- matches: has_resp 如果有结果
exec: accept 流程结束
- exec: $forward_cf 以上都没 match ,说明是表外的域名,直接发送到国外 dns 取 real ip
- matches: "!resp_ip 0.0.0.0/0 2000::/3" 如果没有 real ip 返回
exec: reject 0 直接返回 rcode 0 ,客户端收到 no error 信息,但是没有 ip
- matches: "!resp_ip $geoip_cn" 如果有非中国 IP 返回
exec: $forward_remote 发送到 sing-box dns 请求 fakeip ,抛弃 real ip
如果是中国 IP ,则不会向 sing-box dns 请求 fakeip ,流程已结束,中国 ip 被接受。

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.