diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua
index 66bcf000f..151c9af58 100644
--- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua
+++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua
@@ -510,10 +510,13 @@ function settings_add()
-- Enable/disable obfs
local obfs = luci.http.formvalue("obfs") or 0
+ local obfs_plugin = luci.http.formvalue("obfs_plugin") or "v2ray"
ucic:foreach("shadowsocks-libev", "ss_redir", function (section)
ucic:set("shadowsocks-libev",section[".name"],"obfs",obfs)
+ ucic:set("shadowsocks-libev",section[".name"],"obfs_plugin",obfs_plugin)
end)
ucic:set("shadowsocks-libev","tracker","obfs",obfs)
+ ucic:set("shadowsocks-libev","tracker","obfs_plugin",obfs_plugin)
ucic:save("shadowsocks-libev")
ucic:commit("shadowsocks-libev")
diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm
index 4dc6e6a70..4b3088974 100644
--- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm
+++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm
@@ -58,13 +58,20 @@
end)
%>
-
+
checked<% end %>>
- <%:OBFS will be enabled on both side%>
+ <%:Obfuscating will be enabled on both side%>
+
+
+
+
diff --git a/luci-app-shadowsocks-libev/Makefile b/luci-app-shadowsocks-libev/Makefile
index 3fcc74251..ac7aa30c6 100644
--- a/luci-app-shadowsocks-libev/Makefile
+++ b/luci-app-shadowsocks-libev/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Support for shadowsocks-libev
-LUCI_DEPENDS:=+shadowsocks-libev-config +shadowsocks-libev-ss-local +shadowsocks-libev-ss-redir +shadowsocks-libev-ss-rules +shadowsocks-libev-ss-server +shadowsocks-libev-ss-tunnel +simple-obfs
+LUCI_DEPENDS:=+shadowsocks-libev-config +shadowsocks-libev-ss-local +shadowsocks-libev-ss-redir +shadowsocks-libev-ss-rules +shadowsocks-libev-ss-server +shadowsocks-libev-ss-tunnel +simple-obfs +v2ray-plugin
PKG_LICENSE:=Apache-2.0
diff --git a/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/instance-details.lua b/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/instance-details.lua
index d87c8bef3..209380d6c 100644
--- a/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/instance-details.lua
+++ b/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/instance-details.lua
@@ -27,7 +27,8 @@ s:taboption("general", Flag, "disabled", translate("Disable"))
ss.option_install_package(s, "general")
ss.options_common(s, "advanced")
local obfs_installed = nixio.fs.access("/usr/bin/obfs-local")
-if obfs_installed then
+local v2ray_installed = nixio.fs.access("/usr/bin/v2ray-plugin")
+if obfs_installed or v2ray_installed then
ss.options_obfs(s, "obfuscate")
end
@@ -47,9 +48,11 @@ else
translate("The address ss-tunnel will forward traffic to"))
o.datatype = "hostport"
end
- if obfs_installed then
+ if obfs_installed or v2ray_installed then
o = s:taboption("obfuscate", Value, "obfs_host", translate("Host"))
o.default = "www.bing.com"
+ end
+ if obfs_installed then
s:taboption("obfuscate", Value, "obfs_uri", translate("HTTP path uri"))
end
end
diff --git a/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua b/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua
index 96eb67d0e..317622b55 100644
--- a/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua
+++ b/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua
@@ -131,10 +131,22 @@ end
function options_obfs(s, tab)
local o
+ local v2ray_installed = nixio.fs.access("/usr/bin/v2ray-plugin")
+ local obfs_installed = nixio.fs.access("/usr/bin/obfs-local")
s:taboption(tab, Flag, "obfs", translate("Enable"))
+ o = s:taboption(tab, ListValue, "obfs_plugin", translate("Plugin"))
+ if v2ray_installed then
+ o:value("v2ray")
+ o.default = "v2ray"
+ else
+ o.default = "obfs-simple"
+ end
+ if obfs_installed then
+ o:value("obfs-simple")
+ end
o = s:taboption(tab, ListValue, "obfs_type", translate("Type"))
o:value("http")
- o:value("tls")
+ --o:value("tls")
o.default = "http"
end
diff --git a/openmptcprouter/files/etc/init.d/openmptcprouter-vps b/openmptcprouter/files/etc/init.d/openmptcprouter-vps
index e5fb46916..98cc5856e 100755
--- a/openmptcprouter/files/etc/init.d/openmptcprouter-vps
+++ b/openmptcprouter/files/etc/init.d/openmptcprouter-vps
@@ -103,6 +103,8 @@ _get_ss_redir() {
[ "$cf_no_delay" = "1" ] && no_delay="true"
config_get cf_obfs $1 obfs
[ "$cf_obfs" = "1" ] && obfs="true"
+ config_get cf_obfs_plugin $1 obfs_plugin
+ config_get cf_obfs_type $1 obfs_type
}
_set_ss_server_vps() {
@@ -123,6 +125,8 @@ _set_ss_server_vps() {
current_method="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.method')"
current_ebpf="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.ebpf')"
current_obfs="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.obfs')"
+ current_obfs_plugin="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.obfs_plugin')"
+ current_obfs_type="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.obfs_type')"
current_fast_open="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.fast_open')"
current_no_delay="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.no_delay')"
@@ -130,12 +134,14 @@ _set_ss_server_vps() {
fast_open="false"
no_delay="false"
obfs="false"
+ obfs_plugin="v2ray"
+ obfs_type="http"
config_load shadowsocks-libev
config_foreach _get_ss_redir ss_redir
- if [ "$current_port" != "$port" ] || [ "$current_method" != "$method" ] || [ "$current_key" != "$key" ] || [ "$current_ebpf" != "$ebpf" ] || [ "$current_obfs" != "$obfs" ] || [ "$current_fast_open" != "$fast_open" ] || [ "$current_no_delay" != "$no_delay" ]; then
+ if [ "$current_obfs_plugin" != "$obfs_plugin" ] || [ "$current_obfs_type" != "$obfs_type" ] || [ "$current_port" != "$port" ] || [ "$current_method" != "$method" ] || [ "$current_key" != "$key" ] || [ "$current_ebpf" != "$ebpf" ] || [ "$current_obfs" != "$obfs" ] || [ "$current_fast_open" != "$fast_open" ] || [ "$current_no_delay" != "$no_delay" ]; then
local settings
- settings='{"port": '$port',"method":"'$method'","fast_open":'$fast_open',"reuse_port":true,"no_delay":'$no_delay',"mptcp":true,"key":"'$key'","ebpf":'$ebpf',"obfs":'$obfs'}'
+ settings='{"port": '$port',"method":"'$method'","fast_open":'$fast_open',"reuse_port":true,"no_delay":'$no_delay',"mptcp":true,"key":"'$key'","ebpf":'$ebpf',"obfs":'$obfs',"obfs_plugin":"'$obfs_plugin'","obfs_type":"'$obfs_type'"}'
_set_json "shadowsocks" "$settings"
fi
}
@@ -276,12 +282,14 @@ _set_config_from_vps() {
ss_no_delay="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.no_delay')"
ss_fast_open="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.fast_open')"
ss_obfs="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.obfs')"
+ ss_obfs_plugin="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.obfs_plugin')"
#ss_reuse_port="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.reuse_port')"
config_load shadowsocks-libev
config_foreach _set_ss_redir ss_redir "no_delay" $ss_no_delay
config_foreach _set_ss_redir ss_redir "fast_open" $ss_fast_open
config_foreach _set_ss_redir ss_redir "ebpf" $ss_ebpf
config_foreach _set_ss_redir ss_redir "obfs" $ss_obfs
+ config_foreach _set_ss_redir ss_redir "obfs_plugin" $ss_obfs_plugin
uci -q batch <<-EOF >/dev/null
set shadowsocks-libev.sss0.key=$ss_key
set shadowsocks-libev.sss0.server_port=$ss_port
diff --git a/shadowsocks-libev/files/shadowsocks-libev.init b/shadowsocks-libev/files/shadowsocks-libev.init
index 43bbf1027..7ce491a59 100644
--- a/shadowsocks-libev/files/shadowsocks-libev.init
+++ b/shadowsocks-libev/files/shadowsocks-libev.init
@@ -92,15 +92,27 @@ ss_mkjson_ss_local_conf() {
ss_mkjson_server_conf
[ "$obfs" = 0 ] && obfs=false || obfs=true
if $obfs; then
- obfs_options="obfs=$obfs_type"
- [ -z "$obfs_host" ] || obfs_options="$obfs_options;obfs-host=$obfs_host"
- [ -z "$obfs_uri" ] || obfs_options="$obfs_options;obfs-uri=$obfs_uri"
- [ "$fast_open" = true ] && obfs_options="$obfs_options;fast-open"
- [ "$mptcp" = true ] && obfs_options="$obfs_options;mptcp"
- [ -z "$timeout" ] || obfs_options="$obfs_options;t=$timeout"
- cat <<-EOF
- ${obfs:+${q}plugin${q}: ${q}/usr/bin/obfs-local${q},${q}plugin_opts${q}: ${q}$obfs_options${q},}
- EOF
+ if [ "$obfs_plugin" = "obfs" ]; then
+ obfs_options="obfs=$obfs_type"
+ [ -z "$obfs_host" ] || obfs_options="$obfs_options;obfs-host=$obfs_host"
+ [ -z "$obfs_uri" ] || obfs_options="$obfs_options;obfs-uri=$obfs_uri"
+ [ "$fast_open" = true ] && obfs_options="$obfs_options;fast-open"
+ [ "$mptcp" = true ] && obfs_options="$obfs_options;mptcp"
+ [ -z "$timeout" ] || obfs_options="$obfs_options;t=$timeout"
+ cat <<-EOF
+ ${obfs:+${q}plugin${q}: ${q}/usr/bin/obfs-local${q},${q}plugin_opts${q}: ${q}$obfs_options${q},}
+ EOF
+ fi
+ if [ "$obfs_plugin" = "v2ray" ]; then
+ obfs_options="loglevel=default"
+ [ "$obfs_type" = "tls" ] && obfs_options="tls"
+ [ -z "$obfs_host" ] || obfs_options="$obfs_options;host=$obfs_host"
+ [ -z "$obfs_uri" ] || obfs_options="$obfs_options;path=$obfs_uri"
+ [ "$fast_open" = true ] && obfs_options="$obfs_options;fast-open"
+ cat <<-EOF
+ ${obfs:+${q}plugin${q}: ${q}/usr/bin/v2ray-plugin${q},${q}plugin_opts${q}: ${q}$obfs_options${q},}
+ EOF
+ fi
fi
}
@@ -112,15 +124,27 @@ ss_mkjson_ss_redir_conf() {
EOF
[ "$obfs" = 0 ] && obfs=false || obfs=true
if $obfs; then
- obfs_options="obfs=$obfs_type"
- [ -z "$obfs_host" ] || obfs_options="$obfs_options;obfs-host=$obfs_host"
- [ -z "$obfs_uri" ] || obfs_options="$obfs_options;obfs-uri=$obfs_uri"
- [ "$fast_open" = true ] && obfs_options="$obfs_options;fast-open"
- [ "$mptcp" = true ] && obfs_options="$obfs_options;mptcp"
- [ -z "$timeout" ] || obfs_options="$obfs_options;t=$timeout"
- cat <<-EOF
- ${obfs:+${q}plugin${q}: ${q}/usr/bin/obfs-local${q},${q}plugin_opts${q}: ${q}$obfs_options${q},}
- EOF
+ if [ "$obfs_plugin" = "obfs" ]; then
+ obfs_options="obfs=$obfs_type"
+ [ -z "$obfs_host" ] || obfs_options="$obfs_options;obfs-host=$obfs_host"
+ [ -z "$obfs_uri" ] || obfs_options="$obfs_options;obfs-uri=$obfs_uri"
+ [ "$fast_open" = true ] && obfs_options="$obfs_options;fast-open"
+ [ "$mptcp" = true ] && obfs_options="$obfs_options;mptcp"
+ [ -z "$timeout" ] || obfs_options="$obfs_options;t=$timeout"
+ cat <<-EOF
+ ${obfs:+${q}plugin${q}: ${q}/usr/bin/obfs-local${q},${q}plugin_opts${q}: ${q}$obfs_options${q},}
+ EOF
+ fi
+ if [ "$obfs_plugin" = "v2ray" ]; then
+ obfs_options="loglevel=default"
+ [ "$obfs_type" = "tls" ] && obfs_options="tls"
+ [ -z "$obfs_host" ] || obfs_options="$obfs_options;host=$obfs_host"
+ [ -z "$obfs_uri" ] || obfs_options="$obfs_options;path=$obfs_uri"
+ [ "$fast_open" = true ] && obfs_options="$obfs_options;fast-open"
+ cat <<-EOF
+ ${obfs:+${q}plugin${q}: ${q}/usr/bin/v2ray-plugin${q},${q}plugin_opts${q}: ${q}$obfs_options${q},}
+ EOF
+ fi
fi
}
@@ -128,13 +152,23 @@ ss_mkjson_ss_server_conf() {
ss_mkjson_server_conf_
[ "$obfs" = 0 ] && obfs=false || obfs=true
if $obfs; then
- obfs_options="obfs=$obfs_type"
- [ "$fast_open" = true ] && obfs_options="$obfs_options;fast-open"
- [ "$mptcp" = true ] && obfs_options="$obfs_options;mptcp"
- [ -z "$timeout" ] || obfs_options="$obfs_options;t=$timeout"
- cat <<-EOF
- ${obfs:+${q}plugin${q}: ${q}/usr/bin/obfs-server${q},${q}plugin_opts${q}: ${q}$obfs_options${q},}
- EOF
+ if [ "$obfs_plugin" = "obfs" ]; then
+ obfs_options="obfs=$obfs_type"
+ [ "$fast_open" = true ] && obfs_options="$obfs_options;fast-open"
+ [ "$mptcp" = true ] && obfs_options="$obfs_options;mptcp"
+ [ -z "$timeout" ] || obfs_options="$obfs_options;t=$timeout"
+ cat <<-EOF
+ ${obfs:+${q}plugin${q}: ${q}/usr/bin/obfs-server${q},${q}plugin_opts${q}: ${q}$obfs_options${q},}
+ EOF
+ fi
+ if [ "$obfs_plugin" = "v2ray" ]; then
+ obfs_options="server"
+ [ "$obfs_type" = "tls" ] && obfs_options="tls"
+ [ "$fast_open" = true ] && obfs_options="$obfs_options;fast-open"
+ cat <<-EOF
+ ${obfs:+${q}plugin${q}: ${q}/usr/bin/v2ray-plugin${q},${q}plugin_opts${q}: ${q}$obfs_options${q},}
+ EOF
+ fi
fi
}
@@ -146,13 +180,25 @@ ss_mkjson_ss_tunnel_conf() {
EOF
[ "$obfs" = 0 ] && obfs=false || obfs=true
if $obfs; then
- obfs_options="obfs=$obfs_type"
- [ -z "$obfs_host" ] || obfs_options="$obfs_options;obfs-host=$obfs_host"
- [ -z "$obfs_uri" ] || obfs_options="$obfs_options;obfs-uri=$obfs_uri"
- [ -z "$timeout" ] || obfs_options="$obfs_options;t=$timeout"
- cat <<-EOF
- ${obfs:+${q}plugin${q}: ${q}/usr/bin/obfs-local${q},${q}plugin_opts${q}: ${q}$obfs_options${q},}
- EOF
+ if [ "$obfs_plugin" = "obfs" ]; then
+ obfs_options="obfs=$obfs_type"
+ [ -z "$obfs_host" ] || obfs_options="$obfs_options;obfs-host=$obfs_host"
+ [ -z "$obfs_uri" ] || obfs_options="$obfs_options;obfs-uri=$obfs_uri"
+ [ -z "$timeout" ] || obfs_options="$obfs_options;t=$timeout"
+ cat <<-EOF
+ ${obfs:+${q}plugin${q}: ${q}/usr/bin/obfs-local${q},${q}plugin_opts${q}: ${q}$obfs_options${q},}
+ EOF
+ fi
+ if [ "$obfs_plugin" = "v2ray" ]; then
+ obfs_options="loglevel=default"
+ [ "$obfs_type" = "tls" ] && obfs_options="tls"
+ [ -z "$obfs_host" ] || obfs_options="$obfs_options;host=$obfs_host"
+ [ -z "$obfs_uri" ] || obfs_options="$obfs_options;path=$obfs_uri"
+ [ "$fast_open" = true ] && obfs_options="$obfs_options;fast-open"
+ cat <<-EOF
+ ${obfs:+${q}plugin${q}: ${q}/usr/bin/v2ray-plugin${q},${q}plugin_opts${q}: ${q}$obfs_options${q},}
+ EOF
+ fi
fi
}
@@ -427,6 +473,7 @@ validate_common_options_() {
'timeout:uinteger' \
'user:string' \
'obfs:bool:0' \
+ 'obfs_plugin:or("v2ray","obfs-simple"):v2ray' \
'obfs_type:or("http","tls"):http'
}
diff --git a/shadowsocks-v2ray-plugin-bin/Makefile b/shadowsocks-v2ray-plugin-bin/Makefile
new file mode 100644
index 000000000..a8ea52c00
--- /dev/null
+++ b/shadowsocks-v2ray-plugin-bin/Makefile
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2018-2019 chenhw2
+#
+# This is free software, licensed under the GNU General Public License v3.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=v2ray-plugin
+PKG_VERSION:=1.0
+PKG_RELEASE:=8cea1a3
+PKG_MAINTAINER:=chenhw2
+
+# OpenWrt ARCH: arm, i386, x86_64, mips, mipsel
+# Golang ARCH: arm[5-7], 386, amd64, mips, mipsle
+PKG_ARCH:=$(ARCH)
+BIN_ARCH:=$(ARCH)
+ifeq ($(ARCH),mipsel)
+ PKG_ARCH:=mips
+ BIN_ARCH:=mipsle
+endif
+ifeq ($(ARCH),i386)
+ PKG_ARCH:=386
+ BIN_ARCH:=386
+endif
+ifeq ($(ARCH),x86_64)
+ PKG_ARCH:=amd64
+ BIN_ARCH:=amd64
+endif
+ifeq ($(ARCH),arm)
+ BIN_ARCH:=arm7
+endif
+
+PKG_SOURCE:=v2ray-plugin-linux-$(PKG_ARCH)-$(PKG_RELEASE).tar.gz
+PKG_SOURCE_URL:=https://github.com/shadowsocks/v2ray-plugin/releases/download/v$(PKG_VERSION)/
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_HASH:=skip
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/v2ray-plugin
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=SIP003 plugin for shadowsocks, based on v2ray
+ URL:=https://github.com/shadowsocks/v2ray-plugin
+endef
+
+define Package/v2ray-plugin/description
+ Yet another SIP003 plugin for shadowsocks, based on v2ray
+endef
+
+define Build/Prepare
+ gzip -dc "$(DL_DIR)/$(PKG_SOURCE)" | tar -C $(PKG_BUILD_DIR)/ -xf -
+endef
+
+define Build/Compile
+ echo "$(PKG_NAME)Compile Skiped!"
+endef
+
+define Package/v2ray-plugin/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/v2ray-plugin_linux_$(BIN_ARCH) $(1)/usr/bin/v2ray-plugin
+endef
+
+$(eval $(call BuildPackage,v2ray-plugin))