mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-04 01:06:36 +08:00
增加协议屏蔽支持
This commit is contained in:
@@ -16,6 +16,8 @@ jobs:
|
|||||||
if: contains(github.event.head_commit.message, '[skip gost]') == false
|
if: contains(github.event.head_commit.message, '[skip gost]') == false
|
||||||
name: Build & Compress GOST Binary
|
name: Build & Compress GOST Binary
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
|||||||
@@ -147,5 +147,4 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o gost
|
// GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o gost
|
||||||
//
|
|
||||||
// upx --best --lzma gost
|
// upx --best --lzma gost
|
||||||
|
|||||||
+4
-19
@@ -272,25 +272,16 @@ block_protocol() {
|
|||||||
# 构造 IP 排除字符串
|
# 构造 IP 排除字符串
|
||||||
ip_expr=""
|
ip_expr=""
|
||||||
for ip in "${ips[@]}"; do
|
for ip in "${ips[@]}"; do
|
||||||
ip_expr+=" ip.src != \"$ip\" && ip.dst != \"$ip\" && "
|
ip_expr+="ip.src != \"$ip\" && "
|
||||||
done
|
done
|
||||||
ip_expr=${ip_expr% && }
|
ip_expr=${ip_expr% && }
|
||||||
|
|
||||||
# 内网和本机流量规则
|
|
||||||
net_expr="!cidr(ip.src, \"127.0.0.0/8\") && !cidr(ip.dst, \"127.0.0.0/8\") &&
|
|
||||||
!cidr(ip.src, \"192.168.0.0/16\") && !cidr(ip.dst, \"192.168.0.0/16\") &&
|
|
||||||
!cidr(ip.src, \"10.0.0.0/8\") && !cidr(ip.dst, \"10.0.0.0/8\") &&
|
|
||||||
!cidr(ip.src, \"172.16.0.0/12\") && !cidr(ip.dst, \"172.16.0.0/12\")"
|
|
||||||
|
|
||||||
# 写入规则
|
# 写入规则
|
||||||
[[ "$block_http" == "y" ]] && cat >> "$file" <<EOF
|
[[ "$block_http" == "y" ]] && cat >> "$file" <<EOF
|
||||||
- name: block http
|
- name: block http
|
||||||
action: block
|
action: block
|
||||||
log: true
|
log: true
|
||||||
expr: >
|
expr: http != nil && $ip_expr
|
||||||
http != nil &&
|
|
||||||
$net_expr &&
|
|
||||||
$ip_expr
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
[[ "$block_tls" == "y" ]] && cat >> "$file" <<EOF
|
[[ "$block_tls" == "y" ]] && cat >> "$file" <<EOF
|
||||||
@@ -298,10 +289,7 @@ EOF
|
|||||||
- name: block tls
|
- name: block tls
|
||||||
action: block
|
action: block
|
||||||
log: true
|
log: true
|
||||||
expr: >
|
expr: tls != nil && $ip_expr
|
||||||
tls != nil &&
|
|
||||||
$net_expr &&
|
|
||||||
$ip_expr
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
[[ "$block_socks5" == "y" ]] && cat >> "$file" <<EOF
|
[[ "$block_socks5" == "y" ]] && cat >> "$file" <<EOF
|
||||||
@@ -309,10 +297,7 @@ EOF
|
|||||||
- name: block socks
|
- name: block socks
|
||||||
action: block
|
action: block
|
||||||
log: true
|
log: true
|
||||||
expr: >
|
expr: socks != nil && $ip_expr
|
||||||
socks != nil &&
|
|
||||||
$net_expr &&
|
|
||||||
$ip_expr
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo "📝 已生成 $file"
|
echo "📝 已生成 $file"
|
||||||
|
|||||||
Reference in New Issue
Block a user