Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

代理是成功了,分享一下 #79

Open
dlliang14 opened this issue Aug 18, 2024 · 6 comments
Open

代理是成功了,分享一下 #79

dlliang14 opened this issue Aug 18, 2024 · 6 comments

Comments

@dlliang14
Copy link

安装clash

仓库教程

https://github.com/Elegycloud/clash-for-linux-backup
unzip clash-for-linux-backup-main.zip 
mkdir /soft/clash/
mv clash-for-linux-backup-main /soft/clash/
cd /soft/clash/clash-for-linux-backup-main/
先修改env里的订阅地址
vim .env
`https://xxx/xxx?clash=1`

bash /soft/clash/clash-for-linux-backup-main/start.sh

Clash Dashboard 访问地址: http://<ip>:9090/ui
http://localhost:9090/ui
Secret: d2c7028e1812b834690fbfcccd90721f0f8d710716559a6c6713badfc17b53c0

source /etc/profile.d/clash.sh
请执行以下命令开启系统代理: proxy_on
若要临时关闭系统代理,请执行: proxy_off

[root@k8s-master01 clash-for-linux-backup-main]# bash start.sh 
CPU architecture: x86_64

正在检测订阅地址...
Clash订阅地址可访问!                                      [  OK  ]

正在下载Clash配置文件...
配置文件config.yaml下载成功!                              [  OK  ]

判断订阅内容是否符合clash配置文件标准:
订阅内容符合clash标准

正在启动Clash服务...
服务启动成功!                                             [  OK  ]

Clash Dashboard 访问地址: http://<ip>:9090/ui
Secret: 9748570bfb2cae1549144af874eaf36b87a6f3726b85d59727866973a7cdaeb0

     く__,.ヘヽ.        /  ,ー、 〉
           \ ', !-─‐-i  /  /´
          /`ー'       L//`ヽ、
         /   /,   /|   ,   ,       ',
        イ   / /-‐/  i  L_ ハ ヽ!   i
        レ ヘ 7イ`ト   レ'ァ-ト、!ハ|   |
          !,/7 '0'     ´0iソ|    |
          |.从     _     ,,,, / |./    |
          レ'| i>.、,,__  _,.イ /   .i   |
           レ'| | / k_7_/レ'ヽ,  ハ.  |
             | |/i 〈|/   i  ,.ヘ |  i  |
            .|/ /  i:    ヘ!    \  |
             kヽ>、ハ    _,.ヘ、    /、!
             !'〈//`T´', \ `'7'ーr'
             レ'ヽL__|___i,___,ンレ|ノ
                  ト-,/  |___./
                  'ー'    !_,.:
本项目完全免费,若你是收费买的,恭喜您,您被骗了!
项目地址:https://github.com/Elegycloud/clash-for-linux-backup
项目随时会寄,且行且珍惜!
请执行以下命令加载环境变量: source /etc/profile.d/clash.sh

请执行以下命令开启系统代理: proxy_on

若要临时关闭系统代理,请执行: proxy_off

开关代理

bash /soft/clash/clash-for-linux-backup-main/start.sh
ps aux |grep [c]lash-linux-amd64

请执行以下命令开启系统代理: proxy_on

若要临时关闭系统代理,请执行: proxy_off

若找不到proxy_on指令 source /etc/profile.d/clash.sh

测试代理情况
-L:跟随重定向

curl -x http://127.0.0.1:7890 -L https://www.google.com/
curl -x http://127.0.0.1:7890 -L https://www.baidu.com/
curl -x http://127.0.0.1:7890 -L https://www.github.com/
curl -L https://www.github.com/

curl: (35) Encountered end of file,则表示代理有问题

订阅修改

开启服务
bash /soft/clash/clash-for-linux-backup-main/start.sh
proxy_on

临时关闭代理
proxy_off

关闭服务
bash /soft/clash/clash-for-linux-backup-main/shutdown.sh
服务关闭成功,请执行以下命令关闭系统代理:proxy_off

脚本有问题 就自己手选算了

api_url="http://localhost:9090"
# 秘钥每次start都会换
Secret="89a5efee48a566bd77fa250b335a1a8e214ce07056ca7917e1439a304ec87d21"
# 规则模式:Rule(规则) / Global(全局代理)/ Direct(全局直连)
modes=("Global" "Rule")
mode="Rule"
mgroup="🔰国外流量"
proxy="专线|新加坡02解锁"

# 换代理规则
curl -XPATCH -s "$api_url/configs" -H "Content-Type: application/json" -H "Authorization: Bearer ${Secret}" -d '{"mode":"'"${mode}"'"}' > /dev/null
# 换代理节点
curl -X PUT -s "$api_url/proxies/$mgroup" -H "Content-Type: application/json" -H "Authorization: Bearer ${Secret}" --data "{\"name\":\"$proxy\"}" > /dev/null
curl -X PUT -s "$api_url/proxies/%F0%9F%94%B0%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%8F" -H "Content-Type: application/json" -H "Authorization: Bearer ${Secret}" --data "{\"name\":\"$proxy\"}" > /dev/null

排查相关指令

netstat -tln | grep -E '9090|789.'
env | grep -E 'http_proxy|https_proxy'

尝试解析

通过图形化界面firefox分析Clash Dashboard
有以下几种请求地址
PATCH http://localhost:9090/configs
{
"mode": "Global"
}
curl -XPATCH -s "$api_url/configs" -H "Content-Type: application/json" -H "Authorization: Bearer ${Secret}" -d '{"mode":"'"${mode}"'"}' > /dev/null

put http://localhost:9090/proxies/%F0%9F%94%B0%E5%9B%BD%E5%A4%96%E6%B5%81%E9%87%8F
{
"name": "专线|新加坡01解锁"
}
curl -X PUT -s "$api_url/proxies/$mgroup" -H "Content-Type: application/json" -H "Authorization: Bearer ${Secret}" --data "{\"name\":\"$proxy\"}" > /dev/null

get http://localhost:9090/proxies
curl -s -XGET -H "Content-Type: application/json" -H "Authorization: Bearer 9748570bfb2cae1549144af874eaf36b87a6f3726b85d59727866973a7cdaeb0" http://localhost:9090/proxies

get http://localhost:9090/providers/proxies

GET ws://localhost:9090/logs?token=d2c7028e1812b834690fbfcccd90721f0f8d710716559a6c6713badfc17b53c0&level=silent
需要ws的id

@dongchuanjian
Copy link

.env里的CLASH_URL应该配置为什么?

@dongchuanjian
Copy link

我把airtcp中下载的config.yml替换了temp下的clash.yaml,然后注释掉了start.sh中对ClASH_URL的处理,也能执行通过,显示启动成功,但是测试访问外网不行

@KitanoSakurana
Copy link
Collaborator

哎嘿

1 similar comment
@KitanoSakurana
Copy link
Collaborator

哎嘿

@KitanoSakurana KitanoSakurana pinned this issue Sep 1, 2024
@jiegege8
Copy link

执行start.sh的时候 里面有一段报错: 解码后的内容不符合clash标准,尝试将其转换为标准格式
配置文件转换标准格式失败 这个应该怎么办

@zhatlaen
Copy link

执行start.sh的时候 里面有一段报错: 解码后的内容不符合clash标准,尝试将其转换为标准格式 配置文件转换标准格式失败 这个应该怎么办

前加sudo试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants