Merge Lean's source

This commit is contained in:
CN_SZTL 2020-03-04 08:51:40 +08:00
commit 8b8ec4def3
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
18 changed files with 130 additions and 108 deletions

View File

@ -1,20 +0,0 @@
反馈bug/问题模板,提建议请删除
## 1.关于你要提交的问题
Q是否搜索了issue
A* [ ] 没有类似的issue
## 2. 详细叙述
### (1) 具体问题
A
### (2) 路由器型号和固件版本
A
### (3) 详细日志
A

View File

@ -1,2 +0,0 @@
Q你知道这是`pull request`吗?
A* [ ] 我知道

View File

@ -10,10 +10,8 @@ LUCI_TITLE:=LuCI for Nps
LUCI_DEPENDS:=+wget +npc
LUCI_PKGARCH:=all
PKG_VERSION:=1.1
PKG_RELEASE:=3
PKG_RELEASE:=4
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -1,28 +0,0 @@
# zh_CN translation for npc.
# Copyright (C) 2015 Yoyodyne, Inc. (msgids)
# This file is distributed under the same license as the gettext package.
#
msgid ""
msgstr ""
"PO-Revision-Date: 2015-09-01 09:53中国标准时间\n"
"Last-Translator: Ardentwheel <Ardentwheel@gmail.com>\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Nps Setting"
msgstr "Nps内网穿透"
msgid "Enable Compression"
msgstr "使用压缩传输"
msgid "Enable Encryption"
msgstr "使用加密传输"
msgid "The contents will be compressed to speed up the traffic forwarding speed, but this will consume some additional cpu resources"
msgstr "压缩传输内容,加快流量转发速度,会额外消耗 cpu 资源"
msgid "Encrypted the communication between Npc and Nps, will effectively prevent the traffic intercepted."
msgstr "加密传输 npc 与 nps 之间的通信内容,会有效防止流量被拦截"

View File

@ -43,5 +43,3 @@ log_level:value(7,"Debug")
log_level.default="3"
return m

View File

@ -4,10 +4,10 @@ XHR.poll(3, '<%=url([[admin]], [[services]], [[nps]], [[status]])%>', null,
var tb = document.getElementById('nps_status');
if (data && tb) {
if (data.running) {
var links = '<em><b><font color=green>nps <%:RUNNING%></font></b></em>';
var links = "<em><b style='color:green;'>Nps <%:RUNNING%></b></em>";
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color=red>nps <%:NOT RUNNING%></font></b></em>';
tb.innerHTML = "<em><b style='color:red;'>Nps <%:NOT RUNNING%></b></em>";
}
}
}

View File

@ -0,0 +1,29 @@
msgid "Nps Setting"
msgstr "Nps 内网穿透"
msgid "Nps is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet."
msgstr "Nps 是一种快速反向代理,可帮助您将 NAT 或防火墙后面的本地服务器公开到 Internet。"
msgid "Must an IPv4 address"
msgstr "必须是 IPv4 地址"
msgid "vkey"
msgstr "密钥(vkey)"
msgid "Enable Compression"
msgstr "使用压缩传输"
msgid "Enable Encryption"
msgstr "使用加密传输"
msgid "The contents will be compressed to speed up the traffic forwarding speed, but this will consume some additional cpu resources."
msgstr "压缩传输内容,加快流量转发速度,会额外消耗 CPU 资源。"
msgid "Encrypted the communication between Npc and Nps, will effectively prevent the traffic intercepted."
msgstr "加密传输 npc 与 nps 之间的通信内容,会有效防止流量被拦截。"
msgid "<b style='color:green;'>Nps is running.</b>"
msgstr "<b style='color:green;'>Nps 运行中</b>"
msgid "<b style='color:red;'>Nps is not running.</b>"
msgstr "<b style='color:red;'>Nps 未运行</b>"

View File

@ -4,7 +4,7 @@
START=50
USE_PROCD=1
LOGFILE="/var/etc/nps.log"
LOGFILE="/tmp/nps.log"
tmpconf="/tmp/etc/nps.conf"
nps_header() {

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=157
PKG_VERSION:=158
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@ -36,10 +36,6 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server
bool "Include ShadowsocksR Server"
default y if x86_64
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks
bool "Include Socks Sever"
default y if x86_64
endef
define Package/$(PKG_NAME)
@ -48,15 +44,14 @@ define Package/$(PKG_NAME)
SUBMENU:=3. Applications
TITLE:=SS/SSR/V2Ray/Trojan LuCI interface
PKGARCH:=all
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +pdnsd-alt +wget +lua +ipt2socks \
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +pdnsd-alt +wget +lua +ipt2socks +microsocks \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
+PACKAGE_$(PKG_NAME)_INCLUDE_Simple_obfs:simple-obfs \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin:v2ray-plugin \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks:srelay
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server
endef
define Build/Prepare

View File

@ -1,22 +1,5 @@
local shadowsocksr = "shadowsocksr"
local uci = luci.model.uci.cursor()
local server_table = {}
uci:foreach(shadowsocksr, "servers", function(s)
if s.alias then
server_table[s[".name"]] = "[%s]:%s" %{string.upper(s.type), s.alias}
elseif s.server and s.server_port then
server_table[s[".name"]] = "[%s]:%s:%s" %{string.upper(s.type), s.server, s.server_port}
end
end)
local key_table = {}
for key,_ in pairs(server_table) do
table.insert(key_table,key)
end
table.sort(key_table)
m = Map(shadowsocksr)
m = Map("shadowsocksr")
-- [[ global ]]--
s = m:section(TypedSection, "global", translate("Server failsafe auto swith settings"))
s.anonymous = true
@ -65,11 +48,11 @@ o = s:option(Value, "chnroute_url", translate("Update url"))
o.default = "https://cdn.jsdelivr.net/gh/17mon/china_ip_list/china_ip_list.txt"
-- [[ SOCKS Proxy ]]--
if nixio.fs.access("/usr/bin/srelay") then
s = m:section(TypedSection, "socks5_proxy", translate("SOCKS Proxy"))
if nixio.fs.access("/usr/bin/microsocks") then
s = m:section(TypedSection, "socks5_proxy", translate("SOCKS5 Proxy Server Settings"))
s.anonymous = true
o = s:option(Flag, "socks", translate("Enable SOCKS Proxy"))
o = s:option(Flag, "socks", translate("Enable SOCKS5 Proxy Server"))
o.rmempty = false
o = s:option(Value, "local_port", translate("Local Port"))
@ -77,5 +60,18 @@ o.datatype = "port"
o.default = 1080
o.rmempty = false
o = s:option(Flag, "auth_enable", translate("Enable Authentication"))
o.rmempty = false
o.default = "0"
o = s:option(Value, "username", translate("Username"))
o.rmempty = false
o:depends("auth_enable", "1")
o = s:option(Value, "password", translate("Password"))
o.password = true
o.rmempty = false
o:depends("auth_enable", "1")
end
return m

View File

@ -65,7 +65,7 @@ if luci.sys.call("busybox ps -w | grep ssr-retcp | grep -v grep >/dev/null") ==
redir_run=1
end
if luci.sys.call("pidof srelay >/dev/null") == 0 then
if luci.sys.call("pidof microsocks >/dev/null") == 0 then
sock5_run=1
end
@ -113,8 +113,8 @@ else
s.value = translate("Not Running")
end
if nixio.fs.access("/usr/bin/srelay") then
s=m:field(DummyValue,"sock5_run",translate("SOCKS Proxy"))
if nixio.fs.access("/usr/bin/microsocks") then
s=m:field(DummyValue,"sock5_run",translate("SOCKS5 Proxy Server"))
s.rawhtml = true
if sock5_run == 1 then
s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off

View File

@ -14,7 +14,7 @@ local dsp = require "luci.dispatcher"
const dom = doms[index];
const port = ports[index];
if (!dom) res()
port.innerHTML = '<font color="#0072c3">connecting...</font>';
port.innerHTML = '<font color="#0072c3">connect</font>';
XHR.get('<%=dsp.build_url("admin/services/shadowsocksr/ping")%>', {
index,

View File

@ -422,7 +422,7 @@ msgid "Auto Update Server subscription, GFW list and CHN route"
msgstr "自动更新服务器订阅、GFW列表和 CHN路由表"
msgid "Subscribe URL"
msgstr "SS/SSR/V2RAY/Trojan订阅URL地址"
msgstr "SS/SSR/V2/TROJAN订阅URL"
msgid "Update"
msgstr "更新"
@ -606,3 +606,15 @@ msgstr "订阅新节点自动切换设置"
msgid "Subscribe new add server default Auto-Switch on"
msgstr "订阅加入的新节点默认开启自动切换"
msgid "SOCKS5 Proxy Server Settings"
msgstr "SOCKS5 代理服务端设置"
msgid "Enable SOCKS5 Proxy Server"
msgstr "启用 SOCKS5 代理服务"
msgid "Enable Authentication"
msgstr "启用 用户名/密码 认证"
msgid "SOCKS5 Proxy Server"
msgstr "SOCKS5 代理服务端"

View File

@ -452,10 +452,12 @@ start_server() {
start_local() {
local local_server=$(uci_get_by_type socks5_proxy socks 0)
[ "$local_server" == "0" ] && return 0
mkdir -p /var/run /var/etc
echo '0.0.0.0 any' >/var/etc/srelay.conf
/usr/bin/srelay -q -c /var/etc/srelay.conf \
-i:$(uci_get_by_type socks5_proxy local_port 1080) >/dev/null 2>&1
local auth_enable=$(uci_get_by_type socks5_proxy auth_enable 0)
if [ "$auth_enable" == "1" ]; then
microsocks -i 0.0.0.0 -p $(uci_get_by_type socks5_proxy local_port 1080) -1 -u $(uci_get_by_type socks5_proxy username) -P $(uci_get_by_type socks5_proxy password) >/dev/null 2>&1 &
else
microsocks -i 0.0.0.0 -p $(uci_get_by_type socks5_proxy local_port 1080) >/dev/null 2>&1 &
fi
local_enable=1
}
@ -538,6 +540,7 @@ stop() {
killall -q -9 ssr-local
killall -q -9 pdnsd
killall -q -9 srelay
killall -q -9 microsocks
if [ -f "/tmp/dnsmasq.d/dnsmasq-ssr.conf" ]; then
rm -f /tmp/dnsmasq.d/dnsmasq-ssr.conf
/etc/init.d/dnsmasq restart >/dev/null 2>&1

View File

@ -40,8 +40,6 @@ password=$(uci_get_by_name $GLOBAL_SERVER kcp_password)
kcp_param=$(uci_get_by_name $GLOBAL_SERVER kcp_param)
[ "$password" != "" ] && password="--key "${password}
sock5_port=$(uci_get_by_type socks5_proxy local_port 1080)
if echo "$server" | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then
server=${server}
else
@ -97,13 +95,18 @@ while [ "1" == "1" ]; do #死循环
(/usr/bin/kcptun-client -r $server:$kcp_port -l :$server_port $password $kcp_param &)
fi
fi
#srelay
#microsocks
if [ "$local_process" -gt 0 ]; then
icount=$(busybox ps -w | grep srelay | grep -v grep | wc -l)
icount=$(busybox ps -w | grep microsocks | grep -v grep | wc -l)
if [ "$icount" -lt "$local_process" ]; then #如果进程挂掉就重启它
logger -t "$NAME" "srelay error.restart!"
killall -q -9 srelay
(/usr/bin/srelay -q -c /etc/srelay.conf -i:$sock5_port -p /var/run/srelay.pid >/dev/null 2>&1)
logger -t "$NAME" "microsocks error.restart!"
killall -q -9 microsocks
local auth_enable=$(uci_get_by_type socks5_proxy auth_enable 0)
if [ "$auth_enable" == "1" ]; then
microsocks -i 0.0.0.0 -p $(uci_get_by_type socks5_proxy local_port 1080) -1 -u $(uci_get_by_type socks5_proxy username) -P $(uci_get_by_type socks5_proxy password) >/dev/null 2>&1 &
else
microsocks -i 0.0.0.0 -p $(uci_get_by_type socks5_proxy local_port 1080) >/dev/null 2>&1 &
fi
fi
fi
#pdnsd

View File

@ -85,7 +85,7 @@ ipset_r() {
EOF
ipset -N gfwlist hash:net 2>/dev/null
$IPT -N SS_SPEC_WAN_AC
$IPT -I SS_SPEC_WAN_AC -d $server -j RETURN
$IPT -I SS_SPEC_WAN_AC -p tcp ! --dport 53 -d $server -j RETURN
$IPT -A SS_SPEC_WAN_AC -m set --match-set ss_spec_wan_ac dst -j RETURN
$IPT -A SS_SPEC_WAN_AC -j SS_SPEC_WAN_FW
elif [ "$RUNMODE" == "gfw" ]; then
@ -94,18 +94,18 @@ ipset_r() {
$IPT -A SS_SPEC_WAN_AC -m set --match-set gfwlist dst -j SS_SPEC_WAN_FW
$IPT -A SS_SPEC_WAN_AC -m set --match-set gmlan src -m set ! --match-set china dst -j SS_SPEC_WAN_FW
$IPT -A SS_SPEC_WAN_AC -m set --match-set china dst -j RETURN
$IPT -I SS_SPEC_WAN_AC -d $server -j RETURN
$IPT -I SS_SPEC_WAN_AC -p tcp ! --dport 53 -d $server -j RETURN
elif [ "$RUNMODE" == "oversea" ]; then
ipset -N oversea hash:net 2>/dev/null
$IPT -N SS_SPEC_WAN_AC
ipset -N gmlan hash:net 2>/dev/null
for ip in $LAN_GM_IP; do ipset -! add gmlan $ip; done
$IPT -A SS_SPEC_WAN_AC -m set --match-set china dst -j SS_SPEC_WAN_FW
$IPT -I SS_SPEC_WAN_AC -d $server -j RETURN
$IPT -I SS_SPEC_WAN_AC -p tcp ! --dport 53 -d $server -j RETURN
elif [ "$RUNMODE" == "all" ]; then
$IPT -N SS_SPEC_WAN_AC
$IPT -A SS_SPEC_WAN_AC -j SS_SPEC_WAN_FW
$IPT -I SS_SPEC_WAN_AC -d $server -j RETURN
$IPT -I SS_SPEC_WAN_AC -p tcp ! --dport 53 -d $server -j RETURN
fi
ipset -N fplan hash:net 2>/dev/null
for ip in $LAN_FP_IP; do ipset -! add fplan $ip; done
@ -194,7 +194,7 @@ tp_rule() {
$ipt -A SS_SPEC_TPROXY -p udp -d 192.168.0.0/16 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 224.0.0.0/4 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d 240.0.0.0/4 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -d $SERVER -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp ! --dport 53 -d $server -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -m set --match-set bplan src -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -m set --match-set fplan src \
-j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01

View File

@ -0,0 +1,38 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=microsocks
PKG_VERSION=1.0
PKG_RELEASE:=1
PKG_MAINTAINER:=lean
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/rofl0r/microsocks.git
PKG_SOURCE_VERSION:=be545814aeca1158ae38e2d6c66b1197679dab63
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).$(PKG_RELEASE).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/microsocks
SECTION:=net
CATEGORY:=Network
TITLE:=microsocks for OpenWRT
DEPENDS:=
endef
define Package/microsocks/description
microsocks is a Tiny Proxy in C.
endef
define Package/microsocks/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/microsocks $(1)/usr/bin/microsocks
endef
$(eval $(call BuildPackage,microsocks))