mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-06-19 01:35:30 +08:00

* add support shadowsocks * add websocket * add http2 * add only bind local (suitable for reverse proxy) * add drop access lan by default (optional)
29 lines
824 B
Bash
Executable File
29 lines
824 B
Bash
Executable File
#!/bin/sh
|
|
|
|
. $IPKG_INSTROOT/lib/functions.sh
|
|
. $IPKG_INSTROOT/lib/functions/service.sh
|
|
|
|
gen_user_iptables() {
|
|
config_get enable $1 enable
|
|
[ "$enable" = "0" ] && return 0
|
|
config_get remarks $1 remarks
|
|
config_get bind_local $1 bind_local
|
|
config_get port $1 port
|
|
dport=$port
|
|
[ "$bind_local" != "1" ] && {
|
|
iptables -A V2RAY-SERVER -p tcp --dport $dport -m comment --comment "$remarks" -j ACCEPT
|
|
iptables -A V2RAY-SERVER -p udp --dport $dport -m comment --comment "$remarks" -j ACCEPT
|
|
}
|
|
}
|
|
|
|
iptables -F V2RAY-SERVER 2>/dev/null
|
|
iptables -D INPUT -j V2RAY-SERVER 2>/dev/null
|
|
iptables -X V2RAY-SERVER 2>/dev/null
|
|
|
|
enable=$(uci get v2ray_server.@global[0].enable)
|
|
if [ $enable -eq 1 ]; then
|
|
iptables -N V2RAY-SERVER
|
|
iptables -I INPUT -j V2RAY-SERVER
|
|
config_load v2ray_server
|
|
config_foreach gen_user_iptables "user"
|
|
fi |