diff --git a/feeds.conf.default b/feeds.conf.default
index 88db6e6d0..dbb83fae9 100644
--- a/feeds.conf.default
+++ b/feeds.conf.default
@@ -1,4 +1,4 @@
-src-git packages https://github.com/openwrt/packages.git
-src-git luci https://github.com/openwrt/luci.git
+src-git packages https://github.com/openwrt/packages.git;openwrt-18.06
+src-git luci https://github.com/openwrt/luci.git;openwrt-18.06
src-git routing https://git.openwrt.org/feed/routing.git;openwrt-18.06
#src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-18.06
\ No newline at end of file
diff --git a/package/lean/luci-app-v2ray/Makefile b/package/lean/luci-app-v2ray-pro/Makefile
similarity index 90%
rename from package/lean/luci-app-v2ray/Makefile
rename to package/lean/luci-app-v2ray-pro/Makefile
index 0c116e076..cf0eedfda 100644
--- a/package/lean/luci-app-v2ray/Makefile
+++ b/package/lean/luci-app-v2ray-pro/Makefile
@@ -6,10 +6,10 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for V2Ray (Please select lua-cjson package manually)
-LUCI_DEPENDS:=+iptables-mod-tproxy +kmod-ipt-tproxy +ip +ipset-lists +pdnsd-alt +coreutils +coreutils-base64 +coreutils-nohup +dnsmasq-full +ca-certificates +v2ray
+LUCI_DEPENDS:=+iptables-mod-tproxy +kmod-ipt-tproxy +ip +ipset-lists +pdnsd-alt +coreutils +coreutils-base64 +coreutils-nohup +dnsmasq-full +v2ray
LUCI_PKGARCH:=all
PKG_VERSION:=1.0
-PKG_RELEASE:=6
+PKG_RELEASE:=8
include $(TOPDIR)/feeds/luci/luci.mk
diff --git a/package/lean/luci-app-v2ray-pro/luasrc/controller/v2raypro.lua b/package/lean/luci-app-v2ray-pro/luasrc/controller/v2raypro.lua
new file mode 100644
index 000000000..7ee22abd5
--- /dev/null
+++ b/package/lean/luci-app-v2ray-pro/luasrc/controller/v2raypro.lua
@@ -0,0 +1,17 @@
+module("luci.controller.v2raypro", package.seeall)
+function index()
+ if not nixio.fs.access("/etc/config/v2raypro") then
+ return
+ end
+ local page
+ page = entry({"admin", "services", "v2raypro"}, cbi("v2raypro"), _("V2Ray Pro"))
+ page.dependent = true
+ entry({"admin","services","v2raypro","status"},call("act_status")).leaf=true
+end
+
+function act_status()
+ local e={}
+ e.running=luci.sys.call("pgrep v2ray >/dev/null")==0
+ luci.http.prepare_content("application/json")
+ luci.http.write_json(e)
+end
diff --git a/package/lean/luci-app-v2ray/luasrc/model/cbi/v2ray.lua b/package/lean/luci-app-v2ray-pro/luasrc/model/cbi/v2raypro.lua
similarity index 75%
rename from package/lean/luci-app-v2ray/luasrc/model/cbi/v2ray.lua
rename to package/lean/luci-app-v2ray-pro/luasrc/model/cbi/v2raypro.lua
index 4471d3115..44d43fd7c 100644
--- a/package/lean/luci-app-v2ray/luasrc/model/cbi/v2ray.lua
+++ b/package/lean/luci-app-v2ray-pro/luasrc/model/cbi/v2raypro.lua
@@ -1,3 +1,4 @@
+
local fs = require "nixio.fs"
local NXFS = require "nixio.fs"
local WLFS = require "nixio.fs"
@@ -9,21 +10,14 @@ local dog = "/tmp/v2raypro.log"
local http = luci.http
local ucursor = require "luci.model.uci".cursor()
-local Status
-
-if SYS.call("pidof v2ray > /dev/null") == 0 then
- Status = translate("V2Ray is Running")
-else
- Status = translate("V2Ray is Not Running")
-end
-
-m = Map("v2ray")
+m = Map("v2raypro")
m.title = translate("V2Ray Transparent Proxy")
m.description = translate("A fast secure tunnel proxy that help you get through firewalls on your router")
-s = m:section(TypedSection, "v2ray")
+m:section(SimpleSection).template = "v2raypro/v2raypro_status"
+
+s = m:section(TypedSection, "v2raypro")
s.anonymous = true
-s.description = translate(string.format("%s
", Status))
-- ---------------------------------------------------
@@ -56,9 +50,6 @@ safe_dns_tcp = s:taboption("basic",Flag, "safe_dns_tcp", translate("DNS uses TCP
safe_dns_tcp.rmempty = false
-- safe_dns_tcp:depends("more", "1")
--- more_opt = s:taboption("basic",Flag, "more", translate("More Options"),
--- translate("Options for advanced users"))
-
-- timeout = s:taboption("basic",Value, "timeout", translate("Timeout"))
-- timeout.datatype = "range(0,10000)"
-- timeout.placeholder = "60"
@@ -81,89 +72,22 @@ safe_dns_tcp.rmempty = false
--fast_open =s:taboption("basic",Flag, "fast_open", translate("TCP Fast Open"),
-- translate("Enable TCP fast open, only available on kernel > 3.7.0"))
-
-
s:tab("main", translate("Server Setting"))
-use_conf_file = s:taboption("main",Flag, "use_conf_file", translate("Use Config File"))
-use_conf_file.rmempty = false
-
-if nixio.fs.access("/usr/bin/v2ray/v2ctl") then
- conf_file_type = s:taboption("main",ListValue, "conf_file_type", translate("Config File Type"))
- conf_file_type:value("pb","Protobuf")
-else
- conf_file_type = s:taboption("main",ListValue, "conf_file_type", translate("Config File Type"), translate("Warning: Can't find v2ctl. You can only choose Protobuf."))
-end
-conf_file_type:value("json","JSON")
-conf_file_type:depends("use_conf_file", 1)
-
-conf_file_path = s:taboption("main",Value, "conf_file_path", translate("Config File Path"),
- translate("If you choose to upload a new file, please do not modify and this configuration will be overwritten automatically."))
-conf_file_path:depends("use_conf_file", 1)
-
-upload_conf = s:taboption("main",FileUpload, "")
-upload_conf.template = "cbi/other_upload2"
-upload_conf:depends("use_conf_file", 1)
-
-um = s:taboption("main",DummyValue, "", nil)
-um.template = "cbi/other_dvalue"
-um:depends("use_conf_file", 1)
-
-
-
-local conf_dir, fd
-conf_dir = "/etc/v2ray/"
-nixio.fs.mkdir(conf_dir)
-http.setfilehandler(
- function(meta, chunk, eof)
- if not fd then
- if not meta then return end
-
- if meta and chunk then fd = nixio.open(conf_dir .. meta.file, "w") end
-
- if not fd then
- um.value = translate("Create upload file error.")
- return
- end
- end
- if chunk and fd then
- fd:write(chunk)
- end
- if eof and fd then
- fd:close()
- fd = nil
- um.value = translate("File saved to") .. ' "/etc/v2ray/' .. meta.file .. '"'
- ucursor:set("v2ray","v2ray","conf_file_path","/etc/v2ray/" .. meta.file)
- ucursor:commit("v2ray")
- end
- end
-)
-
-if luci.http.formvalue("upload") then
- local f = luci.http.formvalue("ulfile")
- if #f <= 0 then
- um.value = translate("No specify upload file.")
- end
-end
-
-
-
-
server = s:taboption("main",Value, "address", translate("Server Address"))
server.datatype = "host"
-server:depends("use_conf_file", 0)
+server.rmempty = false
server_port = s:taboption("main",Value, "port", translate("Server Port"))
server_port.datatype = "range(0,65535)"
-server_port:depends("use_conf_file", 0)
+server_port.rmempty = false
id = s:taboption("main",Value, "id", translate("ID"))
id.password = true
-id:depends("use_conf_file", 0)
alterId = s:taboption("main",Value, "alterId", translate("Alter ID"))
alterId.datatype = "range(1,65535)"
-alterId:depends("use_conf_file", 0)
+alterId.rmempty = false
security = s:taboption("main",ListValue, "security", translate("Security"))
security:value("none")
@@ -171,13 +95,11 @@ security:value("auto")
security:value("aes-128-cfb")
security:value("aes-128-gcm")
security:value("chacha20-poly1305")
-security:depends("use_conf_file", 0)
network_type = s:taboption("main",ListValue, "network_type", translate("Network Type"))
network_type:value("tcp")
network_type:value("kcp")
network_type:value("ws")
-network_type:depends("use_conf_file", 0)
-- tcp settings
tcp_obfs = s:taboption("main",ListValue, "tcp_obfs", translate("TCP Obfs"))
@@ -238,13 +160,9 @@ ws_headers.datatype = "host"
-- others
tls = s:taboption("main",Flag, "tls", translate("TLS"))
tls.rmempty = false
-tls:depends("use_conf_file", 0)
mux = s:taboption("main",Flag, "mux", translate("Mux"))
mux.rmempty = false
-mux:depends("use_conf_file", 0)
-
-
s:tab("list", translate("User-defined GFW-List"))
gfwlist = s:taboption("list", TextValue, "conf")
@@ -320,11 +238,4 @@ e:value("disable",translate("No Proxy"))
e:value("global",translate("Global Proxy"))
e:value("game",translate("Game Mode"))
--- ---------------------------------------------------
-local apply = luci.http.formvalue("cbi.apply")
-if apply then
- os.execute("chmod +x /etc/init.d/v2raypro &")
- os.execute("/etc/init.d/v2raypro restart >/dev/null 2>&1 &")
-end
-
return m
diff --git a/package/lean/luci-app-v2ray/luasrc/view/cbi/other_upload2.htm b/package/lean/luci-app-v2ray-pro/luasrc/view/cbi/other_upload2.htm
similarity index 100%
rename from package/lean/luci-app-v2ray/luasrc/view/cbi/other_upload2.htm
rename to package/lean/luci-app-v2ray-pro/luasrc/view/cbi/other_upload2.htm
diff --git a/package/lean/luci-app-v2ray-pro/luasrc/view/v2raypro/v2raypro_status.htm b/package/lean/luci-app-v2ray-pro/luasrc/view/v2raypro/v2raypro_status.htm
new file mode 100644
index 000000000..003fa120f
--- /dev/null
+++ b/package/lean/luci-app-v2ray-pro/luasrc/view/v2raypro/v2raypro_status.htm
@@ -0,0 +1,22 @@
+
+
+
diff --git a/package/lean/luci-app-v2ray/po/zh-cn/v2raypro.po b/package/lean/luci-app-v2ray-pro/po/zh-cn/v2raypro.po
similarity index 100%
rename from package/lean/luci-app-v2ray/po/zh-cn/v2raypro.po
rename to package/lean/luci-app-v2ray-pro/po/zh-cn/v2raypro.po
diff --git a/package/lean/luci-app-v2ray-pro/root/etc/config/v2raypro b/package/lean/luci-app-v2ray-pro/root/etc/config/v2raypro
new file mode 100644
index 000000000..18dff0474
--- /dev/null
+++ b/package/lean/luci-app-v2ray-pro/root/etc/config/v2raypro
@@ -0,0 +1,18 @@
+
+config v2raypro 'v2raypro'
+ option gfwlist 'china-banned'
+ option proxy_mode 'M'
+ option safe_dns_tcp '1'
+ option cron_mode '1'
+ option address '4.4.4.4'
+ option port '443'
+ option id '00755892-0921-4433-bd92-04242abd92af'
+ option alterId '64'
+ option security 'aes-128-gcm'
+ option network_type 'ws'
+ option tls '1'
+ option mux '1'
+ option ws_path '/v2ray'
+ option ws_headers 'www.baidu.com'
+ option enabled '0'
+
diff --git a/package/lean/luci-app-v2ray/root/etc/init.d/v2raypro b/package/lean/luci-app-v2ray-pro/root/etc/init.d/v2raypro
similarity index 72%
rename from package/lean/luci-app-v2ray/root/etc/init.d/v2raypro
rename to package/lean/luci-app-v2ray-pro/root/etc/init.d/v2raypro
index 1c210a18f..16362ce83 100755
--- a/package/lean/luci-app-v2ray/root/etc/init.d/v2raypro
+++ b/package/lean/luci-app-v2ray-pro/root/etc/init.d/v2raypro
@@ -1,27 +1,54 @@
#!/bin/sh /etc/rc.common
+#
+#
START=99
-# local port is defined in $V2_CONF_GENERATE_LUA
-SS_REDIR_PORT=7070
-SS_REDIR_PIDFILE=/var/run/v2ray-go.pid
+STOP=10
+
+EXTRA_COMMANDS="reload_rule"
+
+V2RAY_REDIR_PORT=7070
+V2RAY_REDIR_PIDFILE=/var/run/v2ray-redir-go.pid
PDNSD_LOCAL_PORT=7453
-SSRCONF=/etc/v2ray/config.json
-V2_CONF_GENERATE_LUA=/etc/v2ray/gen_config.lua
+V2RAYCONF=/tmp/config.json
CRON_FILE=/etc/crontabs/root
-CONFIG=v2ray
-V2RAY_EXEC_PATH=/usr/bin/v2ray/v2ray
+V2_CONF_GENERATE_LUA=/etc/v2ray/gen_config.lua
+CONFIG=v2raypro
+KEEP_GFWLIST=Y
+vt_np_ipset="china"
+
+get_config()
+{
+ config_get_bool vt_enabled $1 enabled 0
+ config_get vt_server_addr $1 address
+ config_get vt_server_port $1 server_port
+ config_get vt_password $1 password
+ config_get vt_method $1 method
+ config_get vt_protocol $1 protocol
+ config_get vt_protoparam $1 protoparam
+ config_get vt_obfs $1 obfs
+ config_get obfs_param $1 obfs_param
+ config_get vt_proxy_mode $1 proxy_mode
+ config_get vt_timeout $1 timeout
+ config_get vt_safe_dns $1 safe_dns
+ config_get vt_timeout $1 timeout
+ config_get vt_safe_dns $1 safe_dns
+ config_get vt_safe_dns_port $1 safe_dns_port
+ config_get vt_safe_dns_tcp $1 safe_dns_tcp
+ config_get cron_mode $1 cron_mode 1
+}
+
+
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # $covered_subnets, $local_addresses are not required
-covered_subnets=`uci get v2ray.@v2ray[0].covered_subnets 2>/dev/null`
-local_addresses=`uci get v2ray.@v2ray[0].local_addresses 2>/dev/null`
# Get LAN settings as default parameters
[ -f /lib/functions/network.sh ] && . /lib/functions/network.sh
- [ -z "$covered_subnets" ] && network_get_subnet covered_subnets lan
- [ -z "$local_addresses" ] && network_get_ipaddr local_addresses lan
-vt_np_ipset="china" # Must be global variable
+ network_get_subnet covered_subnets lan
+ network_get_ipaddr local_addresses lan
+
+# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
__gfwlist_by_mode()
{
@@ -31,33 +58,19 @@ __gfwlist_by_mode()
esac
}
-
-
-# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
start()
-{
- local vt_enabled=`uci get v2ray.@v2ray[0].enabled 2>/dev/null`
- local vt_safe_dns=`uci get v2ray.@v2ray[0].safe_dns 2>/dev/null`
- local vt_safe_dns_port=`uci get v2ray.@v2ray[0].safe_dns_port 2>/dev/null`
- local vt_safe_dns_tcp=`uci get v2ray.@v2ray[0].safe_dns_tcp 2>/dev/null`
- local vt_proxy_mode=`uci get v2ray.@v2ray[0].proxy_mode`
- local vt_server_addr=`uci get v2ray.@v2ray[0].address`
- local cron_mode=`uci get v2ray.@v2ray[0].cron_mode 2>/dev/null`
- local vt_gfwlist=`__gfwlist_by_mode $vt_proxy_mode`
- local use_conf_file=`uci get v2ray.@v2ray[0].use_conf_file 2>/dev/null`
- local conf_file_path=`uci get v2ray.@v2ray[0].conf_file_path 2>/dev/null`
- local conf_file_type=`uci get v2ray.@v2ray[0].conf_file_type 2>/dev/null`
-
-
+{
+ config_load v2raypro
+ config_foreach get_config v2raypro
+
[ -f /etc/init.d/pdnsd ] && /etc/init.d/pdnsd disable 2>/dev/null
-
- # -----------------------------------------------------------------
+
if [ "$vt_enabled" = 0 ]; then
- echo "WARNING: V2Ray is disabled."
- return 1
+ echo "WARNING: v2ray is disabled."
+ exit 0
fi
-
+
+ local vt_gfwlist=`__gfwlist_by_mode $vt_proxy_mode`
[ -z "$vt_proxy_mode" ] && vt_proxy_mode=M
[ -z "$vt_method" ] && vt_method=table
[ -z "$vt_timeout" ] && vt_timeout=60
@@ -71,24 +84,15 @@ start()
# -----------------------------------------------------------------
###### v2ray ######
+ /usr/bin/lua $V2_CONF_GENERATE_LUA $CONFIG $V2RAYCONF
+ /usr/bin/v2ray/v2ray -config=$V2RAYCONF &
+
+ echo "V2Ray started"
- if [ "$use_conf_file" = 0 ]; then
- /usr/bin/lua $V2_CONF_GENERATE_LUA $CONFIG $SSRCONF
- $V2RAY_EXEC_PATH -config=$SSRCONF &
- else
- $V2RAY_EXEC_PATH -config=$conf_file_path -format=$conf_file_type &
- fi
-
- sleep 3
- if pidof v2ray>/dev/null; then
- echo "V2Ray started"
- else
- return 1
- fi
-
+
# IPv4 firewall rules
- add_rule
-
+ add_rule
+
# -----------------------------------------------------------------
mkdir -p /var/etc/dnsmasq-go.d
###### Anti-pollution configuration ######
@@ -121,15 +125,15 @@ start()
conf-dir=/var/etc/dnsmasq-go.d
EOF
/etc/init.d/dnsmasq restart
-
-
fi
+
add_cron
}
+
stop()
{
-
+
# -----------------------------------------------------------------
rm -rf /var/etc/dnsmasq-go.d
if [ -f /tmp/dnsmasq.d/dnsmasq-go.conf ]; then
@@ -141,16 +145,33 @@ stop()
# --STOP IPv4 firewall---------------------------------------------------------------
del_rule
-
+
# -----------------------------------------------------------------
- if [ -f $SS_REDIR_PIDFILE ]; then
- kill -9 `cat $SS_REDIR_PIDFILE`
- rm -f $SS_REDIR_PIDFILE
+ if [ -f $V2RAY_REDIR_PIDFILE ]; then
+ kill -9 `cat $V2RAY_REDIR_PIDFILE`
+ rm -f $V2RAY_REDIR_PIDFILE
fi
killall -9 v2ray 2>/dev/null
del_cron
}
+
+reload_rule()
+{
+ config_load v2raypro
+ config_foreach get_config v2raypro
+
+ local vt_gfwlist=`__gfwlist_by_mode $vt_proxy_mode`
+
+ KEEP_GFWLIST=Y
+ del_rule
+ add_rule
+ if [ "$vt_safe_dns_tcp" = 1 ]; then
+ stop_pdnsd
+ start_pdnsd
+ fi
+}
+
restart()
{
KEEP_GFWLIST=Y
@@ -158,23 +179,6 @@ restart()
start
}
-reload()
-{
- local vt_enabled=`uci get v2ray.@v2ray[0].enabled 2>/dev/null`
- local vt_server_addr=`uci get v2ray.@v2ray[0].address`
- local vt_safe_dns=`uci get v2ray.@v2ray[0].safe_dns 2>/dev/null`
- local vt_safe_dns_port=`uci get v2ray.@v2ray[0].safe_dns_port 2>/dev/null`
- local vt_safe_dns_tcp=`uci get v2ray.@v2ray[0].safe_dns_tcp 2>/dev/null`
- local vt_proxy_mode=`uci get v2ray.@v2ray[0].proxy_mode`
- local vt_gfwlist=`__gfwlist_by_mode $vt_proxy_mode`
- KEEP_GFWLIST=Y
- del_rule
- add_rule
- if [ "$vt_safe_dns_tcp" = 1 ]; then
- stop_pdnsd
- start_pdnsd
- fi
-}
# $1: upstream DNS server
start_pdnsd()
@@ -185,14 +189,14 @@ start_pdnsd()
[ -n "$safe_dns" ] && tcp_dns_list="$safe_dns,$tcp_dns_list"
#killall -9 pdnsd 2>/dev/null && sleep 1
- kill -9 $(cat /var/run/pdnsd.pid) >/dev/null 2>&1
-
+ kill -9 $(cat /var/run/pdnsd.pid) >/dev/null 2>&1
+
mkdir -p /var/etc /var/pdnsd
if ! test -f "/var/pdnsd/pdnsd.cache"; then
dd if=/dev/zero of="/var/pdnsd/pdnsd.cache" bs=1 count=4 2> /dev/null
chown -R nobody.nogroup /var/pdnsd
fi
-
+
cat > /var/etc/pdnsd.conf < /tmp/gfwupdate.log 2>&1' >> $CRON_FILE
+ echo '0 5 * * * /etc/v2ray/up-gfwlist.sh > /tmp/gfwupdate.log 2>&1' >> $CRON_FILE
fi
echo '0 */1 * * * /etc/v2ray/v2ray-watchdog >> /tmp/v2ray_watchdog.log 2>&1' >> $CRON_FILE
echo '0 1 * * 0 echo "" > /tmp/v2ray_watchdog.log' >> $CRON_FILE
@@ -277,11 +281,6 @@ uci_get_by_type() {
echo ${ret:=$3}
}
-is_ipv6_address()
-{
- echo "$1" | grep -q ":"
-}
-
add_rule()
{
iptables -t nat -N v2ray_pre
@@ -294,9 +293,8 @@ add_rule()
iptables -t nat -A v2ray_pre -d 127.0.0.0/8 -j RETURN
iptables -t nat -A v2ray_pre -d 224.0.0.0/3 -j RETURN
}
-
iptables -t nat -A v2ray_pre -d $vt_server_addr -j RETURN
-
+
iptables -N gameboost -t mangle
ipset -! create gameuser hash:ip maxelem 65536 2>/dev/null
ip rule add fwmark 0x01/0x01 table 100
@@ -305,7 +303,7 @@ add_rule()
iptables -t mangle -A gameboost -p udp -m set --match-set china dst -j RETURN
iptables -t mangle -A gameboost -p udp --dport 53 -j RETURN
iptables -t mangle -A gameboost -p udp -j TPROXY --on-port 7070 --tproxy-mark 0x01/0x01
- iptables -t mangle -A PREROUTING -m set --match-set gameuser src -j gameboost
+ iptables -t mangle -A PREROUTING -m set --match-set gameuser src -j gameboost
for i in $(seq 0 100)
do
@@ -316,11 +314,11 @@ add_rule()
iptables -t nat -A v2ray_pre -s $ip -j RETURN
;;
global)
- iptables -t nat -A v2ray_pre -s $ip -p tcp -j REDIRECT --to $SS_REDIR_PORT
- iptables -t nat -A v2ray_pre -s $ip -j RETURN
+ iptables -t nat -A v2ray_pre -s $ip -p tcp -j REDIRECT --to $V2RAY_REDIR_PORT
+ iptables -t nat -A v2ray_pre -s $ip -j RETURN
;;
game)
- iptables -t nat -A v2ray_pre -p tcp -s $ip -m set ! --match-set china dst -j REDIRECT --to $SS_REDIR_PORT
+ iptables -t nat -A v2ray_pre -p tcp -s $ip -m set ! --match-set china dst -j REDIRECT --to $V2RAY_REDIR_PORT
ipset -! add gameuser $ip
;;
esac
@@ -330,7 +328,7 @@ add_rule()
G) : ;;
S)
iptables -t nat -A v2ray_pre -m set --match-set $vt_np_ipset dst -j RETURN
- iptables -t nat -I OUTPUT -p tcp -m multiport --dports 80,443 -m set ! --match-set $vt_np_ipset dst -j REDIRECT --to $SS_REDIR_PORT
+ iptables -t nat -I OUTPUT -p tcp -m multiport --dports 80,443 -m set ! --match-set $vt_np_ipset dst -j REDIRECT --to $V2RAY_REDIR_PORT
;;
M)
ipset -! create $vt_gfwlist hash:ip maxelem 65536 2>/dev/null
@@ -339,7 +337,7 @@ add_rule()
ipset -! restore < /tmp/addinip.ipset
iptables -t nat -A v2ray_pre -m set ! --match-set $vt_gfwlist dst -j RETURN
iptables -t nat -A v2ray_pre -m set --match-set $vt_np_ipset dst -j RETURN
- iptables -t nat -I OUTPUT -p tcp -m multiport --dports 80,443 -m set --match-set $vt_gfwlist dst -j REDIRECT --to $SS_REDIR_PORT
+ iptables -t nat -I OUTPUT -p tcp -m multiport --dports 80,443 -m set --match-set $vt_gfwlist dst -j REDIRECT --to $V2RAY_REDIR_PORT
;;
V)
vt_np_ipset=""
@@ -349,7 +347,7 @@ add_rule()
esac
local subnet
for subnet in $covered_subnets; do
- iptables -t nat -A v2ray_pre -s $subnet -p tcp -j REDIRECT --to $SS_REDIR_PORT
+ iptables -t nat -A v2ray_pre -s $subnet -p tcp -j REDIRECT --to $V2RAY_REDIR_PORT
done
iptables -t nat -I PREROUTING -p tcp -j v2ray_pre
}
@@ -360,12 +358,12 @@ del_rule()
while iptables -t nat -D PREROUTING -p tcp -j v2ray_pre 2>/dev/null; do :; done
iptables -t nat -X v2ray_pre 2>/dev/null
fi
-
- iptables -t nat -D OUTPUT -p tcp -m multiport --dports 80,443 -m set --match-set china-banned dst -j REDIRECT --to $SS_REDIR_PORT 2>/dev/null
- iptables -t nat -D OUTPUT -p tcp -m multiport --dports 80,443 -m set ! --match-set $vt_np_ipset dst -j REDIRECT --to $SS_REDIR_PORT 2>/dev/null
-
- ip rule del fwmark 0x01/0x01 table 100
- ip route del local 0.0.0.0/0 dev lo table 100
+
+ iptables -t nat -D OUTPUT -p tcp -m multiport --dports 80,443 -m set --match-set china-banned dst -j REDIRECT --to $V2RAY_REDIR_PORT 2>/dev/null
+ iptables -t nat -D OUTPUT -p tcp -m multiport --dports 80,443 -m set ! --match-set $vt_np_ipset dst -j REDIRECT --to $V2RAY_REDIR_PORT 2>/dev/null
+
+ /usr/bin/ip rule del fwmark 0x01/0x01 table 100
+ /usr/bin/ip route del local 0.0.0.0/0 dev lo table 100
if iptables -t mangle -F gameboost 2>/dev/null; then
while iptables -t mangle -D PREROUTING -m set --match-set gameuser src -j gameboost 2>/dev/null; do :; done
iptables -t mangle -X gameboost 2>/dev/null
@@ -377,3 +375,4 @@ del_rule()
# -----------------------------------------------------------------
[ "$KEEP_GFWLIST" = Y ] || ipset destroy "$vt_gfwlist" 2>/dev/null
}
+
diff --git a/package/lean/luci-app-v2ray-pro/root/etc/uci-defaults/v2raypro b/package/lean/luci-app-v2ray-pro/root/etc/uci-defaults/v2raypro
new file mode 100755
index 000000000..fe6731cce
--- /dev/null
+++ b/package/lean/luci-app-v2ray-pro/root/etc/uci-defaults/v2raypro
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+uci -q batch <<-EOF >/dev/null
+ delete ucitrack.@v2raypro[-1]
+ add ucitrack v2raypro
+ set ucitrack.@v2raypro[-1].init=v2raypro
+ commit ucitrack
+ delete firewall.v2raypro
+ set firewall.v2raypro=include
+ set firewall.v2raypro.type=script
+ set firewall.v2raypro.path=/etc/v2raypro.include
+ set firewall.v2raypro.reload=1
+ commit firewall
+EOF
+
+/etc/init.d/v2raypro stop
+/etc/init.d/v2raypro enable
+
+rm -f /tmp/luci-indexcache
+exit 0
diff --git a/package/lean/luci-app-v2ray/root/etc/v2ray/addinip.txt b/package/lean/luci-app-v2ray-pro/root/etc/v2ray/addinip.txt
similarity index 100%
rename from package/lean/luci-app-v2ray/root/etc/v2ray/addinip.txt
rename to package/lean/luci-app-v2ray-pro/root/etc/v2ray/addinip.txt
diff --git a/package/lean/luci-app-v2ray/root/etc/v2ray/base-gfwlist.txt b/package/lean/luci-app-v2ray-pro/root/etc/v2ray/base-gfwlist.txt
similarity index 100%
rename from package/lean/luci-app-v2ray/root/etc/v2ray/base-gfwlist.txt
rename to package/lean/luci-app-v2ray-pro/root/etc/v2ray/base-gfwlist.txt
diff --git a/package/lean/luci-app-v2ray/root/etc/v2ray/gen-gfwlist.sh b/package/lean/luci-app-v2ray-pro/root/etc/v2ray/gen-gfwlist.sh
similarity index 100%
rename from package/lean/luci-app-v2ray/root/etc/v2ray/gen-gfwlist.sh
rename to package/lean/luci-app-v2ray-pro/root/etc/v2ray/gen-gfwlist.sh
diff --git a/package/lean/luci-app-v2ray/root/etc/v2ray/gen_config.lua b/package/lean/luci-app-v2ray-pro/root/etc/v2ray/gen_config.lua
similarity index 67%
rename from package/lean/luci-app-v2ray/root/etc/v2ray/gen_config.lua
rename to package/lean/luci-app-v2ray-pro/root/etc/v2ray/gen_config.lua
index b5300b26c..1b467eb9b 100644
--- a/package/lean/luci-app-v2ray/root/etc/v2ray/gen_config.lua
+++ b/package/lean/luci-app-v2ray-pro/root/etc/v2ray/gen_config.lua
@@ -4,8 +4,8 @@
]]--
local conf_path, json_path = ...
-conf_path = conf_path or "v2ray"
-json_path = json_path or "/etc/v2ray/config.json"
+conf_path = conf_path or "v2raypro"
+json_path = json_path or "/tmp/config.json"
local local_listen_port = 7070
@@ -13,7 +13,7 @@ local cjson = require "cjson.safe"
local ucursor = require "luci.model.uci".cursor()
local lip = require "luci.ip"
-local v2ray_stream_mode = ucursor:get(conf_path, "v2ray", "network_type") -- tcp/kcp/ws
+local v2ray_stream_mode = ucursor:get(conf_path, "v2raypro", "network_type") -- tcp/kcp/ws
function v2ray_get_conf_list(op)
local t = {}
@@ -69,25 +69,25 @@ local v2ray = {
settings = {
vnext = {
[1] = {
- address = ucursor:get(conf_path, "v2ray", "address"),
- port = tonumber(ucursor:get(conf_path, "v2ray", "port")),
+ address = ucursor:get(conf_path, "v2raypro", "address"),
+ port = tonumber(ucursor:get(conf_path, "v2raypro", "port")),
users = {
[1] = {
- id = ucursor:get(conf_path, "v2ray", "id"),
- alterId = tonumber(ucursor:get(conf_path, "v2ray", "alterId")),
- security = ucursor:get(conf_path, "v2ray", "security")
+ id = ucursor:get(conf_path, "v2raypro", "id"),
+ alterId = tonumber(ucursor:get(conf_path, "v2raypro", "alterId")),
+ security = ucursor:get(conf_path, "v2raypro", "security")
},
},
},
},
},
streamSettings = {
- network = ucursor:get(conf_path, "v2ray", "network_type"),
- security = (ucursor:get(conf_path, "v2ray", "tls") == '1') and "tls" or "none",
- tcpSettings = (v2ray_stream_mode == "tcp" and ucursor:get(conf_path, "v2ray", "tcp_obfs") == "http") and {
+ network = ucursor:get(conf_path, "v2raypro", "network_type"),
+ security = (ucursor:get(conf_path, "v2raypro", "tls") == '1') and "tls" or "none",
+ tcpSettings = (v2ray_stream_mode == "tcp" and ucursor:get(conf_path, "v2raypro", "tcp_obfs") == "http") and {
connectionReuse = true,
header = {
- type = ucursor:get(conf_path, "v2ray", "tcp_obfs"),
+ type = ucursor:get(conf_path, "v2raypro", "tcp_obfs"),
request = {
version = "1.1",
method = "GET",
@@ -118,28 +118,28 @@ local v2ray = {
} or nil,
kcpSettings = (v2ray_stream_mode == "kcp") and {
- mtu = tonumber(ucursor:get(conf_path, "v2ray", "kcp_mtu")),
- tti = tonumber(ucursor:get(conf_path, "v2ray", "kcp_tti")),
- uplinkCapacity = tonumber(ucursor:get(conf_path, "v2ray", "kcp_uplink")),
- downlinkCapacity = tonumber(ucursor:get(conf_path, "v2ray", "kcp_downlink")),
- congestion = (ucursor:get(conf_path, "v2ray", "kcp_congestion") == "1") and true or false,
- readBufferSize = tonumber(ucursor:get(conf_path, "v2ray", "kcp_readbuf")),
- writeBufferSize = tonumber(ucursor:get(conf_path, "v2ray", "kcp_writebuf")),
+ mtu = tonumber(ucursor:get(conf_path, "v2raypro", "kcp_mtu")),
+ tti = tonumber(ucursor:get(conf_path, "v2raypro", "kcp_tti")),
+ uplinkCapacity = tonumber(ucursor:get(conf_path, "v2raypro", "kcp_uplink")),
+ downlinkCapacity = tonumber(ucursor:get(conf_path, "v2raypro", "kcp_downlink")),
+ congestion = (ucursor:get(conf_path, "v2raypro", "kcp_congestion") == "1") and true or false,
+ readBufferSize = tonumber(ucursor:get(conf_path, "v2raypro", "kcp_readbuf")),
+ writeBufferSize = tonumber(ucursor:get(conf_path, "v2raypro", "kcp_writebuf")),
header = {
- type = ucursor:get(conf_path, "v2ray", "kcp_obfs")
+ type = ucursor:get(conf_path, "v2raypro", "kcp_obfs")
}
} or nil,
wsSettings = (v2ray_stream_mode == "ws") and {
connectionReuse = true,
- path = ucursor:get(conf_path, "v2ray", "ws_path"),
- headers = (ucursor:get(conf_path, "v2ray", "ws_headers") ~= nil) and {
- Host = ucursor:get(conf_path, "v2ray", "ws_headers")
+ path = ucursor:get(conf_path, "v2raypro", "ws_path"),
+ headers = (ucursor:get(conf_path, "v2raypro", "ws_headers") ~= nil) and {
+ Host = ucursor:get(conf_path, "v2raypro", "ws_headers")
} or nil,
} or nil,
},
mux = {
- enabled = (ucursor:get(conf_path, "v2ray", "mux") == "1") and true or false
+ enabled = (ucursor:get(conf_path, "v2raypro", "mux") == "1") and true or false
},
},
dns = {
diff --git a/package/lean/luci-app-v2ray/root/etc/v2ray/up-gfwlist.sh b/package/lean/luci-app-v2ray-pro/root/etc/v2ray/up-gfwlist.sh
similarity index 100%
rename from package/lean/luci-app-v2ray/root/etc/v2ray/up-gfwlist.sh
rename to package/lean/luci-app-v2ray-pro/root/etc/v2ray/up-gfwlist.sh
diff --git a/package/lean/luci-app-v2ray/root/etc/v2ray/v2ray-watchdog b/package/lean/luci-app-v2ray-pro/root/etc/v2ray/v2ray-watchdog
similarity index 100%
rename from package/lean/luci-app-v2ray/root/etc/v2ray/v2ray-watchdog
rename to package/lean/luci-app-v2ray-pro/root/etc/v2ray/v2ray-watchdog
diff --git a/package/lean/luci-app-v2ray-pro/root/etc/v2raypro.include b/package/lean/luci-app-v2ray-pro/root/etc/v2raypro.include
new file mode 100755
index 000000000..47da9eb97
--- /dev/null
+++ b/package/lean/luci-app-v2ray-pro/root/etc/v2raypro.include
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+v2ray_enable=$(uci get v2raypro.@v2raypro[0].enabled 2>/dev/null)
+
+if [ $v2ray_enable -eq 1 ]; then
+ if pidof v2ray>/dev/null; then
+ /etc/init.d/v2raypro reload_rule
+ else
+ /etc/init.d/v2raypro restart
+ fi
+fi
diff --git a/package/lean/luci-app-v2ray/luasrc/controller/v2ray.lua b/package/lean/luci-app-v2ray/luasrc/controller/v2ray.lua
deleted file mode 100644
index eb891b700..000000000
--- a/package/lean/luci-app-v2ray/luasrc/controller/v2ray.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-module("luci.controller.v2ray", package.seeall)
-function index()
- if not nixio.fs.access("/etc/config/v2ray") then
- return
- end
- local page
- page = entry({"admin", "services", "v2ray"}, cbi("v2ray"), _("V2Ray Pro"))
- page.dependent = true
-end
\ No newline at end of file
diff --git a/package/lean/luci-app-v2ray/root/etc/config/v2ray b/package/lean/luci-app-v2ray/root/etc/config/v2ray
deleted file mode 100644
index 72d28a8aa..000000000
--- a/package/lean/luci-app-v2ray/root/etc/config/v2ray
+++ /dev/null
@@ -1,31 +0,0 @@
-config v2ray 'v2ray'
- option gfwlist 'china-banned'
- option enabled '0'
- option proxy_mode 'M'
- option safe_dns_tcp '1'
- option cron_mode '1'
- option address 'test.TEST'
- option port '443'
- option id '00755892-0921-4433-bd92-04242abd92af'
- option alterId '64'
- option security 'aes-128-gcm'
- option network_type 'ws'
- option tls '1'
- option mux '1'
- option tcp_obfs 'none'
- list tcp_path '/'
- list tcp_host 'www.baidu.com'
- option kcp_obfs 'none'
- option kcp_mtu '1350'
- option kcp_tti '20'
- option kcp_uplink '5'
- option kcp_downlink '20'
- option kcp_congestion '1'
- option kcp_readbuf '2'
- option kcp_writebuf '2'
- option ws_path '/v2ray'
- option ws_headers 'www.baidu.com'
-
-
-
-
diff --git a/package/lean/luci-app-v2ray/root/etc/uci-defaults/v2ray b/package/lean/luci-app-v2ray/root/etc/uci-defaults/v2ray
deleted file mode 100755
index 9b377b010..000000000
--- a/package/lean/luci-app-v2ray/root/etc/uci-defaults/v2ray
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-uci -q batch <<-EOF >/dev/null
- delete firewall.v2ray
- set firewall.v2ray=include
- set firewall.v2ray.type=script
- set firewall.v2ray.path=/etc/v2ray.include
- set firewall.v2ray.reload=1
- commit firewall
-EOF
-
-/etc/init.d/v2raypro stop
-/etc/init.d/v2raypro disable
-
-rm -f /tmp/luci-indexcache
-exit 0
diff --git a/package/lean/luci-app-v2ray/root/etc/v2ray.include b/package/lean/luci-app-v2ray/root/etc/v2ray.include
deleted file mode 100755
index ca519372e..000000000
--- a/package/lean/luci-app-v2ray/root/etc/v2ray.include
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-ssr_enable=$(uci get v2ray.@v2ray[0].enabled 2>/dev/null)
-
-if [ $ssr_enable -eq 1 ]; then
- if pidof v2ray>/dev/null; then
- /etc/init.d/v2raypro reload
- else
- /etc/init.d/v2raypro restart
- fi
-fi
diff --git a/package/lean/v2ray/Makefile b/package/lean/v2ray/Makefile
index 395b1aac7..83b29f854 100644
--- a/package/lean/v2ray/Makefile
+++ b/package/lean/v2ray/Makefile
@@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=v2ray
-PKG_VERSION:=v3.39
+PKG_VERSION:=v3.41
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
ifeq ($(ARCH),x86_64)