咨询一个问题,我们有没有办法检测 github 的访问来切换线路, openwrt 里有这种脚本吗?

207 天前
 xinmans
我现在发现需要频繁切换线路来规避无法访问 github ,很烦躁
860 次点击
所在节点    OpenWrt
12 条回复
AoEiuV020JP
207 天前
线程指的是梯子?那么关键应该是你用的是什么梯子,而不是 openwrt ,
比如 clash 的 url-test , 你可以置顶 test 地址为 github ,那就会自动选择能上 github 的节点了,
不过 github 很容易连不上吗?
AoEiuV020JP
207 天前
@AoEiuV020JP #1 线程=>线路,
AreYou0k
207 天前
@AoEiuV020JP #1 确实, 除了 clash 自动切换其它的都差点意思.
xinmans
207 天前
@AoEiuV020JP 用的 passwall 。
TinyBBC
207 天前
个人认为,是不是你的鸡厂不太行啊。。。
xinmans
207 天前
@TinyBBC 有好的鸡场可以推荐给我
flynaj
207 天前
mwan3 smartdns ,无感
xinmans
205 天前
@flynaj nwan3 略显复杂啊,我还是自己写自己来切换吧
xinmans
205 天前
写了一个脚本实现我需要的能力



#!/bin/sh


check_node_availability() {
local url=$1
response=$(curl -s -I "$url")
if echo "$response" | grep -q "200 OK"; then
echo "$url is accessible"
return 0
else
echo "$url is not accessible"
return 1
fi
}

check_url() {
success_count=0
for _ in 1 2 3
do
if check_node_availability "https://github.com"; then
success_count=$((success_count + 1))
fi
wait
sleep 3
done
return "$success_count"
}

while :
do
# 只在美国和英国节点间切换 tail -10
for node_id in `uci export passwall | grep 'config nodes' | tail -10 | awk '{print $3}'`; do
eval "i=${node_id}"
uci delete passwall.@global[0].tcp_node
wait
uci add_list passwall.@global[0].tcp_node=${i}
uci show passwall.@global[0].tcp_node
wait
uci commit passwall
wait
/etc/init.d/passwall restart
wait
sleep 10
while :
do
success_count=$(check_url)
if [ "$success_count" -ne 3 ]; then
echo "Switching to another node..."
break
else
sleep 600
fi
done
done
done
linuxgo
188 天前
op 里很多插件都可以自动切换线路啊
xinmans
187 天前
@linuxgo 推荐一个?
linuxgo
187 天前
@xinmans #11 openclash ,passwall ,helloworld ,bypass ,这些都可以

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/983871

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX