Skip to content

Commit

Permalink
feat: 透明代理解决方案升级: 完美自适应 TPROXY/TUN/NAT 三种模式
Browse files Browse the repository at this point in the history
1. 透明代理解决方案升级: 完美自适应 TPROXY/TUN/NAT 三种模式

2. 精简代码功能: 去掉DDNS等无关的功能,让插件足够精巧
3. 优先支持TPROXY模式透明代理(**支持IPv6透明代理**)
  • Loading branch information
xiaov committed Apr 18, 2024
1 parent 5c98571 commit 5924f3e
Show file tree
Hide file tree
Showing 100 changed files with 2,366 additions and 10,930 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
repos/
tests/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 13 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,22 @@ generate_package() {
echo "正在生成 release 安装包 ..."
outdir="./release/"
new_version="$1"
arch="${2:-arm64}"
sed -i "s/vClash:.*/vClash:$new_version/" clash/clash/version
echo -n "arm384" > clash/.valid

# 拷贝可执行文件,构建最小安装包
rm -rf ./clash/clash/bin
mkdir ./clash/clash/bin
bin_list="yq jq clash"
for fn in ${bin_list} ; do
cp ./bin/${fn}_for_${arch} ./clash/clash/bin/${fn}
done
tar zcf ./release/clash_384.tar.gz clash/
echo -n "hnd|arm384|arm386|p1axhnd.675x" > clash/.valid
tar zcf ./release/clash.tar.gz clash/
rm -rf ./clash/clash/bin

}

# 更新ruleset内部的文件
Expand Down Expand Up @@ -105,11 +116,11 @@ generate_gfwlist() {
case "$1" in
go)
[[ "$2" == "" ]] && echo "缺少版本号信息!" && exit 1
generate_package $2
generate_package $2 $3
;;
pack)
[[ "$2" == "" ]] && echo "缺少版本号信息!" && exit 1
generate_package $2
generate_package $2 $3
git add ./
git commit -m "docs: 提交$2版本离线包"
git tag $2
Expand Down
1 change: 0 additions & 1 deletion clash/bin/uri_decoder_for_arm64

This file was deleted.

Binary file removed clash/bin/uri_decoder_for_armv5
Binary file not shown.
32 changes: 18 additions & 14 deletions clash/clash/config.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
port: 7890
socks-port: 1080 # SOCKS5代理端口,DNS请求会中转
redir-port: 3333 # 透明代理端口
tproxy-port: 3330 # TPROXY使用的透明代理端口 支持TCP和UDP
mode: rule
allow-lan: true

routing-mark: 0xff
# allow-lan=true时,最好设置内网访问IP,关闭IPv6监听
# '*': bind all IP addresses
# 192.168.122.11: bind a single IPv4 address
# "[aaaa::a8aa:ff:fe09:57d8]": bind a single IPv6 addres
bind-address: '*'
# 不使用IPv6地址(配合上面的bind-address)
ipv6: false

external-controller: 0.0.0.0:9090
external-ui: /koolshare/clash/dashboard/
external-controller: 192.168.50.1:9090
external-ui: /koolshare/clash/dashboard
secret: route


# 启用 tun 模式来路由全局流量
tun:
enable: false
stack: system # 可选参数: system/gvisor/mixed
auto-route: true
auto-detect-interface: true
dns-hijack:
- 8.8.8.8:53
- tcp://8.8.8.8:53
- any:53
- tcp://any:53
dns:
enable: true
ipv6: false
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
listen: 0.0.0.0:7874
listen: 0.0.0.0:1053
nameserver:
- 114.114.114.114
- 223.5.5.5
- 114.114.114.114
- https://doh.pub/dns-query
- https://dns.alidns.com/dns-query
fallback:
Expand All @@ -42,10 +51,8 @@ experimental:
sniff-tls-sni: true
profile:
store-selected: true

# 保留的proxy节点列表(启动配置文件不包含任何节点信息,节点信息通过 proxy-provider 提供)
proxies: []

proxy-providers:
proxy-provider-http001:
type: http
Expand All @@ -63,7 +70,6 @@ proxy-providers:
enable: true
url: http://www.gstatic.com/generate_204
interval: 300

proxy-groups:
- name: 个人节点组
type: select
Expand Down Expand Up @@ -256,7 +262,6 @@ proxy-groups:
proxies:
- DIRECT
- ⭐默认节点组⭐

rule-providers:
Reject:
type: http
Expand Down Expand Up @@ -602,7 +607,7 @@ rule-providers:
interval: 86400
MyBlacklist:
type: http
behavior: classical # domain, ipcidr or classical (仅限 Clash Premium 内核)
behavior: classical # domain, ipcidr or classical (仅限 Clash Premium 内核)
url: https://raw.githubusercontent.com/vxiaov/vClash/ksmerlin386/clash/clash/ruleset/my_blacklist.yaml
path: ./ruleset/my_blacklist.yaml
interval: 86400
Expand All @@ -612,7 +617,6 @@ rule-providers:
url: https://raw.githubusercontent.com/vxiaov/vClash/ksmerlin386/clash/clash/ruleset/my_whitelist.yaml
path: ./ruleset/my_whitelist.yaml
interval: 86400

rules:
- IP-CIDR,198.18.0.1/16,REJECT,no-resolve
- DOMAIN-SUFFIX,local,DIRECT
Expand Down
1 change: 1 addition & 0 deletions clash/clash/dashboard/yacd/assets/Config-c412a416.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clash/clash/dashboard/yacd/assets/Config-cf41b8ef.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion clash/clash/dashboard/yacd/assets/Config.58870520.css

This file was deleted.

1 change: 0 additions & 1 deletion clash/clash/dashboard/yacd/assets/Config.e907894c.js

This file was deleted.

Loading

0 comments on commit 5924f3e

Please sign in to comment.