perf: get public ip through configuring rules

This commit is contained in:
libm committed 2025-06-09 17:59:11 +08:00
1 parent 5688a3f560
commit a0097e1fd1
3 files changed
+8 -7

No files matched your search

+7 -3
View File
@@ -4,9 +4,13 @@ external-ui: public
secret:
# 代理服务器配置
allow-lan: false # 默认关闭,若开启务必设置用户验证以防暴露公网后被滥用
authentication:
# - "username:password" # 用户验证(clashon默认填充验证信息)
allow-lan: false # 若开启务必设置用户验证以防暴露公网后被滥用
authentication:
# - "username:password" # 用户验证(clashon 会自动填充验证信息)
# 自定义规则
rules:
- DOMAIN,api64.ipify.org,DIRECT # 用于 clashui 获取真实公网 IP
# tun 配置
tun:
-3
View File
@@ -60,8 +60,6 @@ function clashstatus() {
}
function clashui() {
# 防止tun模式强制走代理获取不到真实公网ip
clashoff >&/dev/null
_get_ui_port
# 公网ip
# ifconfig.me
@@ -84,7 +82,6 @@ function clashui() {
printf "║ ║\n"
printf "╚═══════════════════════════════════════════════╝\n"
printf "\n"
clashon >&/dev/null
}
_merge_config_restart() {
+1 -1
View File
@@ -209,7 +209,7 @@ function _error_quit() {
_is_bind() {
local port=$1
{ sudo ss -tulnp || sudo netstat -tulnp; } | grep ":${port}\b"
{ sudo ss -anptu || sudo netstat -anptu; } | grep ":${port}\b"
}
_is_already_in_use() {