ssocks: add package
This commit is contained in:
parent
1240366498
commit
a17f8ed262
21
package/ctcgfw/luci-app-ssocks/Makefile
Normal file
21
package/ctcgfw/luci-app-ssocks/Makefile
Normal file
@ -0,0 +1,21 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is a free software, use it under GNU General Public License v3.0.
|
||||
#
|
||||
# Created By [CTCGFW]Project-OpenWrt
|
||||
# https://github.com/project-openwrt
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for sSocks
|
||||
LUCI_DEPENDS:=+busybox +iptables +ssocks
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_NAME:=luci-app-ssocks
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=[CTCGFW]Project-OpenWrt
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
23
package/ctcgfw/luci-app-ssocks/luasrc/controller/ssocks.lua
Normal file
23
package/ctcgfw/luci-app-ssocks/luasrc/controller/ssocks.lua
Normal file
@ -0,0 +1,23 @@
|
||||
-- This is a free software, use it under GNU General Public License v3.0.
|
||||
-- Created By [CTCGFW]Project OpenWRT
|
||||
-- https://github.com/project-openwrt
|
||||
|
||||
module("luci.controller.ssocks", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/ssocks") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "ssocks"},firstchild(), _("sSocks Server"), 50).dependent = false
|
||||
entry({"admin", "services", "ssocks", "general"},cbi("ssocks"), _("Base Setting"), 1)
|
||||
entry({"admin", "services", "ssocks", "log"},form("ssocks_log"), _("Log"), 2)
|
||||
entry({"admin", "services", "ssocks", "status"},call("act_status")).leaf=true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("ps |grep ssocks |grep -v grep >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
41
package/ctcgfw/luci-app-ssocks/luasrc/model/cbi/ssocks.lua
Normal file
41
package/ctcgfw/luci-app-ssocks/luasrc/model/cbi/ssocks.lua
Normal file
@ -0,0 +1,41 @@
|
||||
mp = Map("ssocks", translate("sSocks Server"))
|
||||
mp.description = translate("sSocks Server is a simple, small, and easy-to-use Socks5 server program, but supports TCP on IPv4 only.")
|
||||
|
||||
mp:section(SimpleSection).template = "ssocks/ssocks_status"
|
||||
|
||||
s = mp:section(TypedSection, "ssocks")
|
||||
s.anonymous=true
|
||||
s.addremove=false
|
||||
|
||||
enable = s:option(Flag, "enable", translate("Enable"))
|
||||
enable.default = 0
|
||||
enable.rmempty = false
|
||||
|
||||
bind_addr = s:option(ListValue, "bind_addr", translate("Bind Address"))
|
||||
bind_addr:value("lan", translate("LAN"))
|
||||
bind_addr:value("wan", translate("WAN"))
|
||||
bind_addr.description = translate("The address that sSocks Server binded.")
|
||||
bind_addr.default = "wan"
|
||||
bind_addr.rmempty = false
|
||||
|
||||
listen_port = s:option(Value, "listen_port", translate("Listen Port"))
|
||||
listen_port.description = translate("The port that sSocks Server listened at, don't reuse the port with other program.")
|
||||
listen_port.placeholder = "10800"
|
||||
listen_port.default = "10800"
|
||||
listen_port.datatype = "port"
|
||||
listen_port.rmempty = false
|
||||
|
||||
username = s:option(Value, "username", translate("Username"))
|
||||
username.description = translate("The authorization username, leave blank to deauthorize.")
|
||||
username.placeholder = "Username"
|
||||
username.default = "ctcgfw"
|
||||
username.datatype = "string"
|
||||
|
||||
password = s:option(Value, "password", translate("Password"))
|
||||
password.description = translate("The authorization password, leave blank to deauthorize.")
|
||||
password.placeholder = "Password"
|
||||
password.default = "password"
|
||||
password.datatype = "string"
|
||||
password.password = true
|
||||
|
||||
return mp
|
||||
@ -0,0 +1,14 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/tmp/ssocks.log"
|
||||
|
||||
f = SimpleForm("logview")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 15
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
t.readonly="readonly"
|
||||
|
||||
return f
|
||||
@ -0,0 +1,22 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[unblockneteasemusic]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('unblockneteasemusic_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>UnblockNeteaseMusic <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>UnblockNeteaseMusic <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="unblockneteasemusic_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
41
package/ctcgfw/luci-app-ssocks/po/zh-cn/ssocks.po
Normal file
41
package/ctcgfw/luci-app-ssocks/po/zh-cn/ssocks.po
Normal file
@ -0,0 +1,41 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
||||
msgid "sSocks Server"
|
||||
msgstr "sSocks服务端"
|
||||
|
||||
msgid "sSocks Server is a simple, small, and easy-to-use Socks5 server program, but supports TCP on IPv4 only."
|
||||
msgstr "sSocks服务端是一个简单、小巧且易于使用的Socks5服务器程序,但它仅支持IPv4上的TCP协议。"
|
||||
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "Bind Address"
|
||||
msgstr "绑定地址"
|
||||
|
||||
msgid "The address that sSocks Server binded."
|
||||
msgstr "sSocks服务端所绑定的地址。"
|
||||
|
||||
msgid "LAN"
|
||||
msgstr "局域网"
|
||||
|
||||
msgid "WAN"
|
||||
msgstr "广域网"
|
||||
|
||||
msgid "Listen Port"
|
||||
msgstr "监听端口"
|
||||
|
||||
msgid "The port that sSocks Server listened at, don't reuse the port with other program."
|
||||
msgstr "sSocks服务端所监听的端口,不可与其他程序共用一个端口。"
|
||||
|
||||
msgid "Username"
|
||||
msgstr "用户名"
|
||||
|
||||
msgid "The authorization username, leave blank to deauthorize."
|
||||
msgstr "连接用户名,留空以取消身份验证。"
|
||||
|
||||
msgid "Password"
|
||||
msgstr "密码"
|
||||
|
||||
msgid "The authorization password, leave blank to deauthorize."
|
||||
msgstr "连接密码,留空以取消身份验证。"
|
||||
7
package/ctcgfw/luci-app-ssocks/root/etc/config/ssocks
Normal file
7
package/ctcgfw/luci-app-ssocks/root/etc/config/ssocks
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
config ssocks
|
||||
option enable '0'
|
||||
option bind_addr 'WAN'
|
||||
option listen_port '10800'
|
||||
option username 'ctcgfw'
|
||||
option password 'password'
|
||||
@ -0,0 +1 @@
|
||||
ctcgfw:password
|
||||
40
package/ctcgfw/luci-app-ssocks/root/etc/init.d/ssocks
Executable file
40
package/ctcgfw/luci-app-ssocks/root/etc/init.d/ssocks
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Created By [CTCGFW]Project OpenWRT
|
||||
# https://github.com/project-openwrt
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
enable="$(uci get ssocks.@ssocks[0].enable)"
|
||||
bind_addr="$(uci get ssocks.@ssocks[0].bind_addr)"
|
||||
listen_port="$(uci get ssocks.@ssocks[0].listen_port)"
|
||||
username="$(uci get ssocks.@ssocks[0].username)"
|
||||
password="$(uci get ssocks.@ssocks[0].password)"
|
||||
lan_addr="$(uci get network.lan.ipaddr)"
|
||||
|
||||
start()
|
||||
{
|
||||
stop
|
||||
[ "${enable}" -eq "0" ] && exit 0
|
||||
|
||||
mkdir -p "/tmp/"
|
||||
mkdir -p "/var/etc/"
|
||||
[ "${bind_addr}" == "LAN" ] && bind_address="${lan_addr}" || bind_address="0.0.0.0"
|
||||
if [ -n "${username}" ] && [ -n "${password}" ]; then
|
||||
rm -f /etc/config/ssocks-authorization
|
||||
echo "${username}:${password}" > /etc/config/ssocks-authorization
|
||||
auth_arg="--auth /etc/config/ssocks-authorization"
|
||||
fi
|
||||
/usr/bin/ssocks --port "${listen_port}" --bind "${bind_address}" --log "/tmp/ssocks.log" ${auth_arg} >/dev/null 2>&1 &
|
||||
iptables -I INPUT -p tcp --dport "${listen_port}" -j ACCEPT
|
||||
cat <<-EOF > "/var/etc/ssocks.include"
|
||||
iptables -I INPUT -p tcp --dport "${listen_port}" -j ACCEPT
|
||||
EOF
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
killall -9 ssocks >/dev/null 2>&1
|
||||
rm -f "/etc/config/ssocks-authorization"
|
||||
rm -f "/var/etc/ssocks.include"
|
||||
}
|
||||
17
package/ctcgfw/luci-app-ssocks/root/etc/uci-defaults/ssocks
Executable file
17
package/ctcgfw/luci-app-ssocks/root/etc/uci-defaults/ssocks
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@ssocks[-1]
|
||||
add ucitrack ssocks
|
||||
set ucitrack.@ssocks[-1].init=ssocks
|
||||
commit ucitrack
|
||||
delete firewall.ssocks
|
||||
set firewall.ssocks=include
|
||||
set firewall.ssocks.type=script
|
||||
set firewall.ssocks.path=/var/etc/ssocks.include
|
||||
set firewall.ssocks.reload=1
|
||||
commit firewall
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@ -17,13 +17,14 @@ account.description = translate("本插件监听的HTTP端口,不可与其他
|
||||
account.placeholder = "5200"
|
||||
account.default = "5200"
|
||||
account.datatype = "port"
|
||||
enabled.rmempty = false
|
||||
account.rmempty = false
|
||||
|
||||
account = s:option(Value, "https_port", translate("[HTTPS] 监听端口"))
|
||||
account.description = translate("本插件监听的HTTPS端口,不可与其他程序/HTTP共用一个端口")
|
||||
account.placeholder = "5201"
|
||||
account.default = "5201"
|
||||
account.datatype = "port"
|
||||
enabled.rmempty = false
|
||||
account.rmempty = false
|
||||
|
||||
speedtype = s:option(ListValue, "musicapptype", translate("音源接口"))
|
||||
speedtype:value("default", translate("默认"))
|
||||
|
||||
48
package/ctcgfw/openwrt-ssocks/Makefile
Normal file
48
package/ctcgfw/openwrt-ssocks/Makefile
Normal file
@ -0,0 +1,48 @@
|
||||
#
|
||||
# Copyright (C) 2017-2018 Jian Chang <aa65535@live.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ssocks
|
||||
PKG_VERSION:=0.0.14
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=ssocks-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://download.sourceforge.net/project/ssocks/
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=y0ug
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_DEPENDS:=+zlib
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=sSocks
|
||||
URL:=https://sourceforge.net/projects/ssocks
|
||||
DEPENDS:=+zlib
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
sSocks is a package which contains: a socks5 server implements RFC 1928 (SOCKS V5) and RFC 1929 (Authentication for SOCKS V5), a reverse socks server and client, a netcat like tool and a socks5 relay.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ssocksd $(1)/usr/bin/ssocks
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@ -52,6 +52,9 @@ msgstr "用于压缩内存数据的CPU并发线程数"
|
||||
msgid "Swap"
|
||||
msgstr "虚拟内存"
|
||||
|
||||
msgid "Base Setting"
|
||||
msgstr "基本设置"
|
||||
|
||||
msgid "Force 40MHz mode"
|
||||
msgstr "强制40MHz频宽"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user