forked from kenzok8/small
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbbf889
commit 18758dc
Showing
55 changed files
with
136,996 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=luci-app-ssr-plus | ||
PKG_VERSION:=190 | ||
PKG_RELEASE:=1 | ||
|
||
PKG_CONFIG_DEPENDS:= \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NONE_V2RAY \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Xray \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS_NG \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_MosDNS \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Tuic_Client \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadow_TLS \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_NONE_Client \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_NONE_Server \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Server \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Simple_Obfs \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_V2ray_Plugin \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Client \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Server \ | ||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan | ||
|
||
LUCI_TITLE:=SS/SSR/V2Ray/Trojan/NaiveProxy/Tuic/ShadowTLS/Hysteria/Socks5/Tun LuCI interface | ||
LUCI_PKGARCH:=all | ||
LUCI_DEPENDS:= \ | ||
@(PACKAGE_libustream-mbedtls||PACKAGE_libustream-openssl||PACKAGE_libustream-wolfssl) \ | ||
+coreutils +coreutils-base64 +dns2socks +dns2tcp +dnsmasq-full +@PACKAGE_dnsmasq_full_ipset +ipset +kmod-ipt-nat \ | ||
+ip-full +iptables +iptables-mod-tproxy +lua +lua-neturl +libuci-lua +microsocks \ | ||
+tcping +resolveip +shadowsocksr-libev-ssr-check +uclient-fetch \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:curl \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray-core \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:curl \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS_NG:chinadns-ng \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_MosDNS:mosdns \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_MosDNS:yq \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_MosDNS:v2dat \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_MosDNS:diffutils \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria:hysteria \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Tuic_Client:tuic-client \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadow_TLS:shadow-tls \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks:ipt2socks \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2:redsocks2 \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-local \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-redir \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server:shadowsocks-libev-ss-server \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client:shadowsocks-rust-sslocal \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Server:shadowsocks-rust-ssserver \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Simple_Obfs:simple-obfs \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_V2ray_Plugin:v2ray-plugin \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Client:shadowsocksr-libev-ssr-local \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Client:shadowsocksr-libev-ssr-redir \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Server:shadowsocksr-libev-ssr-server \ | ||
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan | ||
|
||
define Package/$(PKG_NAME)/config | ||
select PACKAGE_luci-lib-ipkg if PACKAGE_$(PKG_NAME) | ||
|
||
choice | ||
prompt "Shadowsocks Client Selection" | ||
default PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client if aarch64 || x86_64 | ||
default PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_NONE_Client | ||
bool "None" | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client | ||
bool "Shadowsocks-libev" | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client | ||
bool "Shadowsocks-rust" | ||
depends on aarch64||arm||i386||mips||mipsel||x86_64 | ||
depends on !(TARGET_x86_geode||TARGET_x86_legacy) | ||
endchoice | ||
|
||
choice | ||
prompt "Shadowsocks Server Selection" | ||
default PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Server if aarch64 | ||
default PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server if i386||x86_64||arm | ||
default PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_NONE_Server | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_NONE_Server | ||
bool "None" | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server | ||
bool "Shadowsocks-libev" | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Server | ||
bool "Shadowsocks-rust" | ||
depends on aarch64||arm||i386||mips||mipsel||x86_64 | ||
depends on !(TARGET_x86_geode||TARGET_x86_legacy) | ||
endchoice | ||
|
||
choice | ||
prompt "V2ray-core Selection" | ||
default PACKAGE_$(PKG_NAME)_INCLUDE_Xray if aarch64||arm||i386||x86_64 | ||
default PACKAGE_$(PKG_NAME)_INCLUDE_NONE_V2RAY | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_NONE_V2RAY | ||
bool "None" | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray | ||
bool "V2ray-core" | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Xray | ||
bool "Xray-core" | ||
endchoice | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS_NG | ||
bool "Include ChinaDNS-NG" | ||
default y | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_MosDNS | ||
bool "Include MosDNS" | ||
default y if aarch64||arm||i386||x86_64 | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria | ||
bool "Include Hysteria" | ||
select PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS_NG | ||
default n | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Tuic_Client | ||
bool "Include Tuic-Client" | ||
select PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS_NG | ||
select PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks | ||
depends on aarch64||arm||i386||x86_64 | ||
depends on !(TARGET_x86_geode||TARGET_x86_legacy) | ||
default n | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadow_TLS | ||
bool "Include Shadow-TLS" | ||
select PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS_NG | ||
select PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client | ||
depends on aarch64||arm||x86_64 | ||
depends on !(TARGET_x86_geode||TARGET_x86_legacy) | ||
default n | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks | ||
bool "Include IPT2Socks" | ||
default n | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun | ||
bool "Include Kcptun" | ||
default n | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy | ||
bool "Include NaiveProxy" | ||
depends on !(arc||armeb||mips||mips64||powerpc||TARGET_gemini) | ||
default n | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 | ||
bool "Include Redsocks2" | ||
default n | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Simple_Obfs | ||
bool "Include Shadowsocks Simple Obfs Plugin" | ||
default y | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_V2ray_Plugin | ||
bool "Include Shadowsocks V2ray Plugin" | ||
default n | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Client | ||
bool "Include ShadowsocksR Libev Client" | ||
default y | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Server | ||
bool "Include ShadowsocksR Libev Server" | ||
default y if i386||x86_64||arm | ||
|
||
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan | ||
bool "Include Trojan" | ||
select PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks | ||
default n | ||
endef | ||
|
||
define Package/$(PKG_NAME)/conffiles | ||
/etc/config/shadowsocksr | ||
/etc/ssrplus/ | ||
endef | ||
|
||
include $(TOPDIR)/feeds/luci/luci.mk | ||
|
||
# call BuildPackage - OpenWrt buildroot signature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
-- Copyright (C) 2017 yushi studio <[email protected]> | ||
-- Licensed to the public under the GNU General Public License v3. | ||
module("luci.controller.shadowsocksr", package.seeall) | ||
|
||
function index() | ||
if not nixio.fs.access("/etc/config/shadowsocksr") then | ||
call("act_reset") | ||
end | ||
local page | ||
page = entry({"admin", "services", "shadowsocksr"}, alias("admin", "services", "shadowsocksr", "client"), _("ShadowSocksR Plus+"), 10) | ||
page.dependent = true | ||
page.acl_depends = { "luci-app-ssr-plus" } | ||
entry({"admin", "services", "shadowsocksr", "client"}, cbi("shadowsocksr/client"), _("SSR Client"), 10).leaf = true | ||
entry({"admin", "services", "shadowsocksr", "servers"}, arcombine(cbi("shadowsocksr/servers", {autoapply = true}), cbi("shadowsocksr/client-config")), _("Servers Nodes"), 20).leaf = true | ||
entry({"admin", "services", "shadowsocksr", "control"}, cbi("shadowsocksr/control"), _("Access Control"), 30).leaf = true | ||
entry({"admin", "services", "shadowsocksr", "advanced"}, cbi("shadowsocksr/advanced"), _("Advanced Settings"), 50).leaf = true | ||
entry({"admin", "services", "shadowsocksr", "server"}, arcombine(cbi("shadowsocksr/server"), cbi("shadowsocksr/server-config")), _("SSR Server"), 60).leaf = true | ||
entry({"admin", "services", "shadowsocksr", "status"}, form("shadowsocksr/status"), _("Status"), 70).leaf = true | ||
entry({"admin", "services", "shadowsocksr", "check"}, call("check_status")) | ||
entry({"admin", "services", "shadowsocksr", "refresh"}, call("refresh_data")) | ||
entry({"admin", "services", "shadowsocksr", "subscribe"}, call("subscribe")) | ||
entry({"admin", "services", "shadowsocksr", "checkport"}, call("check_port")) | ||
entry({"admin", "services", "shadowsocksr", "log"}, form("shadowsocksr/log"), _("Log"), 80).leaf = true | ||
entry({"admin", "services", "shadowsocksr", "run"}, call("act_status")) | ||
entry({"admin", "services", "shadowsocksr", "ping"}, call("act_ping")) | ||
entry({"admin", "services", "shadowsocksr", "reset"}, call("act_reset")) | ||
entry({"admin", "services", "shadowsocksr", "restart"}, call("act_restart")) | ||
entry({"admin", "services", "shadowsocksr", "delete"}, call("act_delete")) | ||
end | ||
|
||
function subscribe() | ||
luci.sys.call("/usr/bin/lua /usr/share/shadowsocksr/subscribe.lua >>/var/log/ssrplus.log") | ||
luci.http.prepare_content("application/json") | ||
luci.http.write_json({ret = 1}) | ||
end | ||
|
||
function act_status() | ||
local e = {} | ||
e.running = luci.sys.call("busybox ps -w | grep ssr-retcp | grep -v grep >/dev/null") == 0 | ||
luci.http.prepare_content("application/json") | ||
luci.http.write_json(e) | ||
end | ||
|
||
function act_ping() | ||
local e = {} | ||
local domain = luci.http.formvalue("domain") | ||
local port = luci.http.formvalue("port") | ||
local transport = luci.http.formvalue("transport") | ||
local wsPath = luci.http.formvalue("wsPath") | ||
local tls = luci.http.formvalue("tls") | ||
e.index = luci.http.formvalue("index") | ||
local iret = luci.sys.call("ipset add ss_spec_wan_ac " .. domain .. " 2>/dev/null") | ||
if transport == "ws" then | ||
local prefix = tls=='1' and "https://" or "http://" | ||
local address = prefix..domain..':'..port..wsPath | ||
local result = luci.sys.exec("curl --http1.1 -m 2 -ksN -o /dev/null -w 'time_connect=%{time_connect}\nhttp_code=%{http_code}' -H 'Connection: Upgrade' -H 'Upgrade: websocket' -H 'Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==' -H 'Sec-WebSocket-Version: 13' "..address) | ||
e.socket = string.match(result,"http_code=(%d+)")=="101" | ||
e.ping = tonumber(string.match(result, "time_connect=(%d+.%d%d%d)"))*1000 | ||
else | ||
local socket = nixio.socket("inet", "stream") | ||
socket:setopt("socket", "rcvtimeo", 3) | ||
socket:setopt("socket", "sndtimeo", 3) | ||
e.socket = socket:connect(domain, port) | ||
socket:close() | ||
-- e.ping = luci.sys.exec("ping -c 1 -W 1 %q 2>&1 | grep -o 'time=[0-9]*.[0-9]' | awk -F '=' '{print$2}'" % domain) | ||
-- if (e.ping == "") then | ||
e.ping = luci.sys.exec(string.format("echo -n $(tcping -q -c 1 -i 1 -t 2 -p %s %s 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print $2}') 2>/dev/null", port, domain)) | ||
-- end | ||
end | ||
if (iret == 0) then | ||
luci.sys.call(" ipset del ss_spec_wan_ac " .. domain) | ||
end | ||
luci.http.prepare_content("application/json") | ||
luci.http.write_json(e) | ||
end | ||
|
||
function check_status() | ||
local e = {} | ||
e.ret = luci.sys.call("/usr/bin/ssr-check www." .. luci.http.formvalue("set") .. ".com 80 3 1") | ||
luci.http.prepare_content("application/json") | ||
luci.http.write_json(e) | ||
end | ||
|
||
function refresh_data() | ||
local set = luci.http.formvalue("set") | ||
local retstring = loadstring("return " .. luci.sys.exec("/usr/bin/lua /usr/share/shadowsocksr/update.lua " .. set))() | ||
luci.http.prepare_content("application/json") | ||
luci.http.write_json(retstring) | ||
end | ||
|
||
function check_port() | ||
local retstring = "<br /><br />" | ||
local s | ||
local server_name = "" | ||
local uci = luci.model.uci.cursor() | ||
local iret = 1 | ||
uci:foreach("shadowsocksr", "servers", function(s) | ||
if s.alias then | ||
server_name = s.alias | ||
elseif s.server and s.server_port then | ||
server_name = "%s:%s" % {s.server, s.server_port} | ||
end | ||
iret = luci.sys.call("ipset add ss_spec_wan_ac " .. s.server .. " 2>/dev/null") | ||
socket = nixio.socket("inet", "stream") | ||
socket:setopt("socket", "rcvtimeo", 3) | ||
socket:setopt("socket", "sndtimeo", 3) | ||
ret = socket:connect(s.server, s.server_port) | ||
if tostring(ret) == "true" then | ||
socket:close() | ||
retstring = retstring .. "<font color = 'green'>[" .. server_name .. "] OK.</font><br />" | ||
else | ||
retstring = retstring .. "<font color = 'red'>[" .. server_name .. "] Error.</font><br />" | ||
end | ||
if iret == 0 then | ||
luci.sys.call("ipset del ss_spec_wan_ac " .. s.server) | ||
end | ||
end) | ||
luci.http.prepare_content("application/json") | ||
luci.http.write_json({ret = retstring}) | ||
end | ||
|
||
function act_reset() | ||
luci.sys.call("/etc/init.d/shadowsocksr reset &") | ||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr")) | ||
end | ||
|
||
function act_restart() | ||
luci.sys.call("/etc/init.d/shadowsocksr restart &") | ||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr")) | ||
end | ||
|
||
function act_delete() | ||
luci.sys.call("/etc/init.d/shadowsocksr restart &") | ||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers")) | ||
end |
Oops, something went wrong.