mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
This commit is contained in:
commit
d0f9ad5120
@ -141,7 +141,7 @@ menu "Target Images"
|
||||
int "Block size (in KiB)"
|
||||
depends on TARGET_ROOTFS_SQUASHFS
|
||||
default 64 if LOW_MEMORY_FOOTPRINT
|
||||
default 256
|
||||
default 1024
|
||||
|
||||
menuconfig TARGET_ROOTFS_UBIFS
|
||||
bool "ubifs"
|
||||
|
56
package/lean/frpc/Makefile
Normal file
56
package/lean/frpc/Makefile
Normal file
@ -0,0 +1,56 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=frpc
|
||||
PKG_VERSION:=0.13
|
||||
PKG_RELEASE:=20171022
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=FRPC Client
|
||||
DEPENDS:=
|
||||
URL:=https://github.com/fatedier/frp/releases
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
|
||||
ifeq ($(ARCH),mipsel)
|
||||
$(INSTALL_BIN) ./files/7620n/frpc $(1)/usr/bin/
|
||||
endif
|
||||
ifeq ($(ARCH),mips)
|
||||
$(INSTALL_BIN) ./files/ar71xx/frpc $(1)/usr/bin/
|
||||
endif
|
||||
ifeq ($(ARCH),i386)
|
||||
$(INSTALL_BIN) ./files/x86/frpc $(1)/usr/bin/
|
||||
endif
|
||||
ifeq ($(ARCH),x86_64)
|
||||
$(INSTALL_BIN) ./files/x86_64/frpc $(1)/usr/bin/
|
||||
endif
|
||||
ifeq ($(ARCH),arm)
|
||||
$(INSTALL_BIN) ./files/arm/frpc $(1)/usr/bin/
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
BIN
package/lean/frpc/files/7620n/frpc
Executable file
BIN
package/lean/frpc/files/7620n/frpc
Executable file
Binary file not shown.
BIN
package/lean/frpc/files/ar71xx/frpc
Executable file
BIN
package/lean/frpc/files/ar71xx/frpc
Executable file
Binary file not shown.
BIN
package/lean/frpc/files/arm/frpc
Executable file
BIN
package/lean/frpc/files/arm/frpc
Executable file
Binary file not shown.
BIN
package/lean/frpc/files/x86/frpc
Executable file
BIN
package/lean/frpc/files/x86/frpc
Executable file
Binary file not shown.
BIN
package/lean/frpc/files/x86_64/frpc
Executable file
BIN
package/lean/frpc/files/x86_64/frpc
Executable file
Binary file not shown.
19
package/lean/luci-app-frpc/Makefile
Normal file
19
package/lean/luci-app-frpc/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI for FRPC
|
||||
LUCI_DEPENDS:=+wget +frpc
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
||||
|
17
package/lean/luci-app-frpc/luasrc/controller/frp.lua
Normal file
17
package/lean/luci-app-frpc/luasrc/controller/frp.lua
Normal file
@ -0,0 +1,17 @@
|
||||
module("luci.controller.frp", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/frp") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin","services","frp"},cbi("frp/frp"), _("Frp Setting"),5).dependent=true
|
||||
entry({"admin","services","frp","config"},cbi("frp/config")).leaf=true
|
||||
entry({"admin","services","frp","status"},call("status")).leaf=true
|
||||
end
|
||||
function status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("pidof frpc > /dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
BIN
package/lean/luci-app-frpc/luasrc/i18n/frp.zh-cn.lmo
Normal file
BIN
package/lean/luci-app-frpc/luasrc/i18n/frp.zh-cn.lmo
Normal file
Binary file not shown.
116
package/lean/luci-app-frpc/luasrc/model/cbi/frp/config.lua
Normal file
116
package/lean/luci-app-frpc/luasrc/model/cbi/frp/config.lua
Normal file
@ -0,0 +1,116 @@
|
||||
local n="frp"
|
||||
local i=require"luci.dispatcher"
|
||||
local o=require"luci.model.network".init()
|
||||
local m=require"nixio.fs"
|
||||
local a,t,e
|
||||
arg[1]=arg[1]or""
|
||||
a=Map(n,translate("Frp Domain Config"))
|
||||
a.redirect=i.build_url("admin","services","frp")
|
||||
t=a:section(NamedSection,arg[1],"frp",translate("Config Frp Protocol"))
|
||||
t.addremove=false
|
||||
t.dynamic=false
|
||||
t:tab("base",translate("Basic Settings"))
|
||||
t:tab("other",translate("Other Settings"))
|
||||
e=t:taboption("base",ListValue,"enable",translate("Enable State"))
|
||||
e.default="1"
|
||||
e.rmempty=false
|
||||
e:value("1",translate("Enable"))
|
||||
e:value("0",translate("Disable"))
|
||||
e=t:taboption("base",ListValue, "type", translate("Frp Protocol Type"))
|
||||
e:value("http",translate("HTTP"))
|
||||
e:value("https",translate("HTTPS"))
|
||||
e:value("tcp",translate("TCP"))
|
||||
e:value("udp",translate("UDP"))
|
||||
e:value("stcp",translate("STCP"))
|
||||
e = t:taboption("base",ListValue, "domain_type", translate("Domain Type"))
|
||||
e.default = "custom_domains"
|
||||
e:value("custom_domains",translate("Custom Domains"))
|
||||
e:value("subdomain",translate("SubDomain"))
|
||||
e:value("both_dtype",translate("Both the above two Domain types"))
|
||||
e:depends("type","http")
|
||||
e:depends("type","https")
|
||||
e = t:taboption("base",Value, "custom_domains", translate("Custom Domains"), translate("If SubDomain is used, Custom Domains couldn't be subdomain or wildcard domain of the maindomain(subdomain_host)."))
|
||||
e:depends("domain_type","custom_domains")
|
||||
e:depends("domain_type","both_dtype")
|
||||
e = t:taboption("base",Value, "subdomain", translate("SubDomain"), translate("subdomain_host must be configured in server: frps in advance."))
|
||||
e:depends("domain_type","subdomain")
|
||||
e:depends("domain_type","both_dtype")
|
||||
e = t:taboption("base",ListValue, "stcp_role", translate("STCP Role"))
|
||||
e.default = "server"
|
||||
e:value("server",translate("STCP Server"))
|
||||
e:value("vistor",translate("STCP Vistor"))
|
||||
e:depends("type","stcp")
|
||||
e = t:taboption("base",Value, "remote_port", translate("Remote Port"))
|
||||
e.datatype = "port"
|
||||
e:depends("type","tcp")
|
||||
e:depends("type","udp")
|
||||
e = t:taboption("other",Flag, "enable_plugin", translate("Use Plugin"),translate("If plugin is defined, local_ip and local_port is useless, plugin will handle connections got from frps."))
|
||||
e.default = "0"
|
||||
e:depends("type","tcp")
|
||||
e = t:taboption("base",Value, "local_ip", translate("Local Host Address"))
|
||||
luci.sys.net.ipv4_hints(function(x,d)
|
||||
e:value(x,"%s (%s)"%{x,d})
|
||||
end)
|
||||
e.datatype = "ip4addr"
|
||||
e:depends("type","udp")
|
||||
e:depends("type","http")
|
||||
e:depends("type","https")
|
||||
e:depends("enable_plugin",0)
|
||||
e = t:taboption("base",Value, "local_port", translate("Local Host Port"))
|
||||
e.datatype = "port"
|
||||
e:depends("type","udp")
|
||||
e:depends("type","http")
|
||||
e:depends("type","https")
|
||||
e:depends("enable_plugin",0)
|
||||
e = t:taboption("base",Value, "stcp_secretkey", translate("STCP Screct Key"))
|
||||
e.default = "abcdefg"
|
||||
e:depends("type","stcp")
|
||||
e = t:taboption("base",Value, "stcp_servername", translate("STCP Server Name"), translate("STCP Server Name is Service Remark Name of STCP Server"))
|
||||
e.default = "secret_tcp"
|
||||
e:depends("stcp_role","vistor")
|
||||
e = t:taboption("other",Flag, "enable_locations", translate("Enable URL routing"), translate("Frp support forward http requests to different backward web services by url routing."))
|
||||
e:depends("type","http")
|
||||
e = t:taboption("other",Value, "locations ", translate("URL routing"), translate("Http requests with url prefix /news will be forwarded to this service."))
|
||||
e.default="locations=/"
|
||||
e:depends("enable_locations",1)
|
||||
e = t:taboption("other",ListValue, "plugin", translate("Choose Plugin"))
|
||||
e:value("http_proxy",translate("http_proxy"))
|
||||
e:value("socks5",translate("socks5"))
|
||||
e:value("unix_domain_socket",translate("unix_domain_socket"))
|
||||
e:depends("enable_plugin",1)
|
||||
e = t:taboption("other",Flag, "enable_plugin_httpuserpw", translate("Proxy Authentication"),translate("Other PCs could access the Internet through frpc's network by using http_proxy plugin."))
|
||||
e.default = "0"
|
||||
e:depends("plugin","http_proxy")
|
||||
e = t:taboption("other",Value, "plugin_http_user", translate("HTTP Proxy UserName"))
|
||||
e.default = "abc"
|
||||
e:depends("enable_plugin_httpuserpw",1)
|
||||
e = t:taboption("other",Value, "plugin_http_passwd", translate("HTTP Proxy Password"))
|
||||
e.default = "abc"
|
||||
e:depends("enable_plugin_httpuserpw",1)
|
||||
e = t:taboption("other",Value, "plugin_unix_path", translate("Plugin Unix Sock Path"))
|
||||
e.default = "/var/run/docker.sock"
|
||||
e:depends("plugin","unix_domain_socket")
|
||||
e = t:taboption("other",Flag, "enable_http_auth", translate("Password protecting your web service"), translate("Http username and password are safety certification for http protocol."))
|
||||
e.default = "0"
|
||||
e:depends("type","http")
|
||||
e = t:taboption("other",Value, "http_user", translate("HTTP UserName"))
|
||||
e.default = "frp"
|
||||
e:depends("enable_http_auth",1)
|
||||
e = t:taboption("other",Value, "http_pwd", translate("HTTP PassWord"))
|
||||
e.default = "frp"
|
||||
e:depends("enable_http_auth",1)
|
||||
e = t:taboption("other",Flag, "enable_host_header_rewrite", translate("Rewriting the Host Header"), translate("Frp can rewrite http requests with a modified Host header."))
|
||||
e.default = "0"
|
||||
e:depends("type","http")
|
||||
e = t:taboption("other",Value, "host_header_rewrite", translate("Host Header"), translate("The Host header will be rewritten to match the hostname portion of the forwarding address."))
|
||||
e.default = "dev.yourdomain.com"
|
||||
e:depends("enable_host_header_rewrite",1)
|
||||
e = t:taboption("base",Flag, "use_encryption", translate("Use Encryption"), translate("Encrypted the communication between frpc and frps, will effectively prevent the traffic intercepted."))
|
||||
e.default = "1"
|
||||
e.rmempty = false
|
||||
e = t:taboption("base",Flag, "use_compression", translate("Use Compression"), translate("The contents will be compressed to speed up the traffic forwarding speed, but this will consume some additional cpu resources."))
|
||||
e.default = "1"
|
||||
e.rmempty = false
|
||||
e = t:taboption("base",Value, "remark", translate("Service Remark Name"), translate("<font color=\"red\">Please ensure the remark name is unique.</font>"))
|
||||
e.rmempty = false
|
||||
return a
|
160
package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua
Normal file
160
package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua
Normal file
@ -0,0 +1,160 @@
|
||||
local o=require"luci.dispatcher"
|
||||
local e=require("luci.model.ipkg")
|
||||
local s=require"nixio.fs"
|
||||
local e=luci.model.uci.cursor()
|
||||
local i="frp"
|
||||
local a,t,e
|
||||
local n={}
|
||||
a=Map(i,translate("Frp Setting"), translate("Frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet."))
|
||||
a:section(SimpleSection).template="frp/frp_status"
|
||||
t=a:section(NamedSection,"common","frp",translate("Global Setting"))
|
||||
t.anonymous=true
|
||||
t.addremove=false
|
||||
t:tab("base",translate("Basic Settings"))
|
||||
t:tab("other",translate("Other Settings"))
|
||||
t:tab("log",translate("Client Log"))
|
||||
e=t:taboption("base",Flag, "enabled", translate("Enabled"))
|
||||
e.rmempty=false
|
||||
e=t:taboption("base",Value, "server_addr", translate("Server"))
|
||||
e.optional=false
|
||||
e.rmempty=false
|
||||
e=t:taboption("base",Value, "server_port", translate("Port"))
|
||||
e.datatype = "port"
|
||||
e.optional=false
|
||||
e.rmempty=false
|
||||
e=t:taboption("base",Value, "privilege_token", translate("Privilege Token"), translate("Time duration between server of frpc and frps mustn't exceed 15 minutes."))
|
||||
e.optional=false
|
||||
e.password=true
|
||||
e.rmempty=false
|
||||
e=t:taboption("base",Value, "vhost_http_port", translate("Vhost HTTP Port"))
|
||||
e.datatype = "port"
|
||||
e.rmempty=false
|
||||
e=t:taboption("base",Value, "vhost_https_port", translate("Vhost HTTPS Port"))
|
||||
e.datatype = "port"
|
||||
e.rmempty=false
|
||||
e=t:taboption("other",Flag, "login_fail_exit", translate("Exit program when first login failed"),translate("decide if exit program when first login failed, otherwise continuous relogin to frps."))
|
||||
e.default = "1"
|
||||
e.rmempty=false
|
||||
e=t:taboption("other",Flag, "tcp_mux", translate("TCP Stream Multiplexing"), translate("Default is Ture. This feature in frps.ini and frpc.ini must be same."))
|
||||
e.default = "1"
|
||||
e.rmempty=false
|
||||
e=t:taboption("other",ListValue, "protocol", translate("Protocol Type"),translate("Frp support kcp protocol since v0.12.0"))
|
||||
e.default = "tcp"
|
||||
e:value("tcp",translate("TCP Protocol"))
|
||||
e:value("kcp",translate("KCP Protocol"))
|
||||
e=t:taboption("other",Flag, "enable_http_proxy", translate("Connect frps by HTTP PROXY"), translate("frpc can connect frps using HTTP PROXY"))
|
||||
e.default = "0"
|
||||
e.rmempty=false
|
||||
e:depends("protocol","tcp")
|
||||
e=t:taboption("other",Value, "http_proxy", translate("HTTP PROXY"))
|
||||
e.datatype="uinteger"
|
||||
e.placeholder="http://user:pwd@192.168.1.128:8080"
|
||||
e:depends("enable_http_proxy",1)
|
||||
e.optional=false
|
||||
e=t:taboption("other",Flag, "enable_cpool", translate("Enable Connection Pool"), translate("This feature is fit for a large number of short connections."))
|
||||
e.rmempty=false
|
||||
e=t:taboption("other",Value, "pool_count", translate("Connection Pool"), translate("Connections will be established in advance."))
|
||||
e.datatype="uinteger"
|
||||
e.default = "1"
|
||||
e:depends("enable_cpool",1)
|
||||
e.optional=false
|
||||
e=t:taboption("base",Value,"time",translate("Service registration interval"),translate("0 means disable this feature, unit: min"))
|
||||
e.datatype="range(0,59)"
|
||||
e.default=30
|
||||
e.rmempty=false
|
||||
e=t:taboption("other",ListValue, "log_level", translate("Log Level"))
|
||||
e.default = "warn"
|
||||
e:value("trace",translate("Trace"))
|
||||
e:value("debug",translate("Debug"))
|
||||
e:value("info",translate("Info"))
|
||||
e:value("warn",translate("Warning"))
|
||||
e:value("error",translate("Error"))
|
||||
e=t:taboption("other",Value, "log_max_days", translate("Log Keepd Max Days"))
|
||||
e.datatype = "uinteger"
|
||||
e.default = "3"
|
||||
e.rmempty=false
|
||||
e.optional=false
|
||||
e=t:taboption("log",TextValue,"log")
|
||||
e.rows=26
|
||||
e.wrap="off"
|
||||
e.readonly=true
|
||||
e.cfgvalue=function(t,t)
|
||||
return s.readfile("/var/etc/frp/frpc.log")or""
|
||||
end
|
||||
e.write=function(e,e,e)
|
||||
end
|
||||
t=a:section(TypedSection,"proxy",translate("Services List"))
|
||||
t.anonymous=true
|
||||
t.addremove=true
|
||||
t.template="cbi/tblsection"
|
||||
t.extedit=o.build_url("admin","services","frp","config","%s")
|
||||
function t.create(e,t)
|
||||
new=TypedSection.create(e,t)
|
||||
luci.http.redirect(e.extedit:format(new))
|
||||
end
|
||||
function t.remove(e,t)
|
||||
e.map.proceed=true
|
||||
e.map:del(t)
|
||||
luci.http.redirect(o.build_url("admin","services","frp"))
|
||||
end
|
||||
local o=""
|
||||
e=t:option(DummyValue,"remark",translate("Service Remark Name"))
|
||||
e.width="10%"
|
||||
e=t:option(DummyValue,"type",translate("Frp Protocol Type"))
|
||||
e.width="10%"
|
||||
e=t:option(DummyValue,"custom_domains",translate("Domain/Subdomain"))
|
||||
e.width="20%"
|
||||
e.cfgvalue=function(t,n)
|
||||
local t=a.uci:get(i,n,"domain_type")or""
|
||||
local m=a.uci:get(i,n,"type")or""
|
||||
if t=="custom_domains" then
|
||||
local b=a.uci:get(i,n,"custom_domains")or"" return b end
|
||||
if t=="subdomain" then
|
||||
local b=a.uci:get(i,n,"subdomain")or"" return b end
|
||||
if t=="both_dtype" then
|
||||
local b=a.uci:get(i,n,"custom_domains")or""
|
||||
local c=a.uci:get(i,n,"subdomain")or""
|
||||
b="%s/%s"%{b,c} return b end
|
||||
if m=="tcp" or m=="udp" then
|
||||
local b=a.uci:get(i,"common","server_addr")or"" return b end
|
||||
end
|
||||
e=t:option(DummyValue,"remote_port",translate("Remote Port"))
|
||||
e.width="10%"
|
||||
e.cfgvalue=function(t,b)
|
||||
local t=a.uci:get(i,b,"type")or""
|
||||
if t==""or b==""then return""end
|
||||
if t=="http" then
|
||||
local b=a.uci:get(i,"common","vhost_http_port")or"" return b end
|
||||
if t=="https" then
|
||||
local b=a.uci:get(i,"common","vhost_https_port")or"" return b end
|
||||
if t=="tcp" or t=="udp" then
|
||||
local b=a.uci:get(i,b,"remote_port")or"" return b end
|
||||
end
|
||||
e=t:option(DummyValue,"local_ip",translate("Local Host Address"))
|
||||
e.width="15%"
|
||||
e=t:option(DummyValue,"local_port",translate("Local Host Port"))
|
||||
e.width="10%"
|
||||
e=t:option(DummyValue,"use_encryption",translate("Use Encryption"))
|
||||
e.width="15%"
|
||||
e.cfgvalue=function(t,n)
|
||||
local t=a.uci:get(i,n,"use_encryption")or""
|
||||
local b
|
||||
if t==""or b==""then return""end
|
||||
if t=="1" then b="ON"
|
||||
else b="OFF" end
|
||||
return b
|
||||
end
|
||||
e=t:option(DummyValue,"use_compression",translate("Use Compression"))
|
||||
e.width="15%"
|
||||
e.cfgvalue=function(t,n)
|
||||
local t=a.uci:get(i,n,"use_compression")or""
|
||||
local b
|
||||
if t==""or b==""then return""end
|
||||
if t=="1" then b="ON"
|
||||
else b="OFF" end
|
||||
return b
|
||||
end
|
||||
e=t:option(Flag,"enable",translate("Enable State"))
|
||||
e.width="10%"
|
||||
e.rmempty=false
|
||||
return a
|
23
package/lean/luci-app-frpc/luasrc/view/frp/frp_status.htm
Normal file
23
package/lean/luci-app-frpc/luasrc/view/frp/frp_status.htm
Normal file
@ -0,0 +1,23 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=url([[admin]], [[services]], [[frp]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('frp_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green><%:The Frp service is running.%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red><%:The Frp service is not running.%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Frp Status%></legend>
|
||||
<p id="frp_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
16
package/lean/luci-app-frpc/root/etc/config/frp
Normal file
16
package/lean/luci-app-frpc/root/etc/config/frp
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
config frp 'common'
|
||||
option log_max_days '3'
|
||||
option login_fail_exit '0'
|
||||
option enable_cpool '0'
|
||||
option time '40'
|
||||
option tcp_mux '1'
|
||||
option enabled '0'
|
||||
option vhost_http_port '80'
|
||||
option vhost_https_port '443'
|
||||
option server_addr 'yourdomain.com'
|
||||
option server_port '7000'
|
||||
option privilege_token '1234567'
|
||||
option log_level 'info'
|
||||
option enable_http_proxy '0'
|
||||
option protocol 'tcp'
|
214
package/lean/luci-app-frpc/root/etc/init.d/frp
Executable file
214
package/lean/luci-app-frpc/root/etc/init.d/frp
Executable file
@ -0,0 +1,214 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#Author: monokoo <realstones2012@gmail.com>
|
||||
#Thanks to FW867's help
|
||||
|
||||
START=99
|
||||
SERVICE_WRITE_PID=1
|
||||
SERVICE_DAEMONIZE=1
|
||||
|
||||
LOGFILE="/var/etc/frp/frpc.log"
|
||||
|
||||
echo_date(){
|
||||
local log=$1
|
||||
echo $(date +%Y/%m/%d\ %X): "$log" >> $LOGFILE
|
||||
}
|
||||
|
||||
Reduce_Log(){
|
||||
local log=$1
|
||||
[ ! -f "$log" ] && return
|
||||
local sc=200
|
||||
[ -n "$2" ] && sc=$2
|
||||
local count=$(grep -c "" $log)
|
||||
if [ $count -gt $sc ];then
|
||||
let count=count-$sc
|
||||
sed -i "1,$count d" $log
|
||||
fi
|
||||
}
|
||||
|
||||
conf_proxy_add() {
|
||||
|
||||
local cfg="$1"
|
||||
local tmpconf="$2"
|
||||
local enable type domain_type custom_domains remote_port local_ip local_port enable_http_auth enable_host_header_rewrite host_header_rewrite
|
||||
local subdomain use_encryption use_compression http_user http_pwd remark locations
|
||||
local enable_plugin plugin plugin_http_user plugin_http_passwd plugin_unix_path stcp_role stcp_secretkey stcp_servername
|
||||
|
||||
config_get_bool enable "$cfg" enable 1
|
||||
[ "$enable" -gt 0 ] || return 1
|
||||
|
||||
config_get type "$cfg" type
|
||||
config_get custom_domains "$cfg" custom_domains
|
||||
config_get subdomain "$cfg" subdomain
|
||||
config_get remote_port "$cfg" remote_port
|
||||
config_get local_ip "$cfg" local_ip
|
||||
config_get local_port "$cfg" local_port
|
||||
config_get locations "$cfg" locations
|
||||
config_get host_header_rewrite "$cfg" host_header_rewrite
|
||||
config_get http_user "$cfg" http_user
|
||||
config_get http_pwd "$cfg" http_pwd
|
||||
config_get remark "$cfg" remark
|
||||
config_get plugin "$cfg" plugin
|
||||
config_get plugin_http_user "$cfg" plugin_http_user
|
||||
config_get plugin_http_passwd "$cfg" plugin_http_passwd
|
||||
config_get plugin_unix_path "$cfg" plugin_unix_path
|
||||
config_get stcp_role "$cfg" stcp_role
|
||||
config_get stcp_secretkey "$cfg" stcp_secretkey
|
||||
config_get stcp_servername "$cfg" stcp_servername
|
||||
|
||||
|
||||
[ -n "$remark" ] && [ -n "$type" ] || return 1
|
||||
|
||||
echo "" >>$tmpconf
|
||||
echo "[$remark]" >>$tmpconf
|
||||
echo "type=$type" >>$tmpconf
|
||||
[ -n "$custom_domains" ] && echo "custom_domains=$custom_domains" >>$tmpconf
|
||||
[ -n "$subdomain" ] && echo "subdomain=$subdomain" >>$tmpconf
|
||||
[ -n "$remote_port" ] && echo "remote_port=$remote_port" >>$tmpconf
|
||||
[ -z "$stcp_role" ] && [ -n "$local_ip" ] && echo "local_ip=$local_ip" >>$tmpconf
|
||||
[ -z "$stcp_role" ] && [ -n "$local_port" ] && echo "local_port=$local_port" >>$tmpconf
|
||||
[ -n "$locations" ] && echo "locations=$locations" >>$tmpconf
|
||||
[ -n "$http_user" -a -n "$http_pwd" ] && {
|
||||
echo "http_user=$http_user" >>$tmpconf
|
||||
echo "http_pwd=$http_pwd" >>$tmpconf
|
||||
}
|
||||
[ -n "$host_header_rewrite" ] && echo "host_header_rewrite=$host_header_rewrite" >>$tmpconf
|
||||
[ -n "$plugin" ] && echo "plugin=$plugin" >>$tmpconf
|
||||
[ -n "$plugin_http_user" -a -n "$plugin_http_passwd" ] && {
|
||||
echo "plugin_http_user=$plugin_http_user" >>$tmpconf
|
||||
echo "plugin_http_passwd=$plugin_http_passwd" >>$tmpconf
|
||||
}
|
||||
[ -n "$plugin_unix_path" ] && echo "plugin_unix_path=$plugin_unix_path" >>$tmpconf
|
||||
|
||||
[ -n "$stcp_role" ] && {
|
||||
if [ "$stcp_role" == "vistor" ]; then
|
||||
echo "role=$stcp_role" >>$tmpconf
|
||||
[ -n "$local_ip" ] && echo "bind_addr=$local_ip" >>$tmpconf
|
||||
[ -n "$local_port" ] && echo "bind_port=$local_port" >>$tmpconf
|
||||
[ -n "$stcp_servername" ] && echo "server_name=$stcp_servername" >>$tmpconf || return 1
|
||||
else
|
||||
[ -n "$local_ip" ] && echo "local_ip=$local_ip" >>$tmpconf
|
||||
[ -n "$local_port" ] && echo "local_port=$local_port" >>$tmpconf
|
||||
fi
|
||||
[ -n "$stcp_secretkey" ] && echo "sk=$stcp_secretkey" >>$tmpconf || return 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
frp_write_bool use_encryption $cfg 1
|
||||
frp_write_bool use_compression $cfg 1
|
||||
|
||||
}
|
||||
|
||||
frp_write_bool() {
|
||||
local opt="$1"
|
||||
local config="$2"
|
||||
local def="$3"
|
||||
local val
|
||||
|
||||
config_get_bool val $config "$opt" "$def"
|
||||
if [ "$val" -eq 0 ]; then
|
||||
echo "${opt}=false" >> $tmpconf
|
||||
else
|
||||
echo "${opt}=true" >> $tmpconf
|
||||
fi
|
||||
}
|
||||
|
||||
frp_add_cru(){
|
||||
time=$1
|
||||
if [ ! -f "/etc/crontabs/root" ] || [ -z "$(cat /etc/crontabs/root | grep frp)" ]; then
|
||||
sed -i '/frp/d' /etc/crontabs/root >/dev/null 2>&1
|
||||
echo "*/$time * * * * /etc/init.d/frp restart" >> /etc/crontabs/root
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
frp_del_cru(){
|
||||
if [ ! -f "/etc/crontabs/root" ] || [ -n "$(cat /etc/crontabs/root | grep frp)" ]; then
|
||||
sed -i '/frp/d' /etc/crontabs/root >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
download_binary(){
|
||||
echo_date "开始下载frpc二进制文件..."
|
||||
/usr/bin/wget --no-check-certificate --timeout=10 --tries=1 -o $LOGFILE https://github.com/fatedier/frp/releases/download/v0.13.0/frp_0.13.0_linux_arm.tar.gz -O /tmp/frp_0.13.0_linux_arm.tar.gz
|
||||
[ ! -s "/tmp/frp_0.13.0_linux_arm.tar.gz" ] && /usr/bin/wget -q --no-check-certificate --timeout=10 --tries=1 https://any.mokoo.xyz/app/frp_0.13.0_linux_arm.tar.gz -O /tmp/frp_0.13.0_linux_arm.tar.gz
|
||||
[ -f "/tmp/frp_0.13.0_linux_arm.tar.gz" ] && tar -xf /tmp/frp_0.13.0_linux_arm.tar.gz -C /tmp && \
|
||||
mv /tmp/frp_0.13.0_linux_arm/frpc /usr/bin/frpc
|
||||
rm -rf /tmp/frp_0.13.0_linux_arm*
|
||||
if [ -f "/usr/bin/frpc" ]; then
|
||||
chmod +x /usr/bin/frpc && echo_date "成功下载frpc二进制文件"
|
||||
else
|
||||
echo_date "下载frpc二进制文件失败,请重试!"
|
||||
fi
|
||||
}
|
||||
|
||||
boot() {
|
||||
sleep 10s
|
||||
start
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
config_load "frp"
|
||||
local enabled server_addr server_port time privilege_token tcp_mux enable_cpool
|
||||
local pool_count log_level log_max_days login_fail_exit http_proxy protocol
|
||||
|
||||
config_get_bool enabled common enabled 1
|
||||
|
||||
[ "$enabled" -gt 0 ] || return 1
|
||||
|
||||
config_get server_addr common server_addr
|
||||
config_get server_port common server_port
|
||||
config_get privilege_token common privilege_token
|
||||
config_get enable_cpool common enable_cpool
|
||||
config_get pool_count common pool_count
|
||||
config_get log_level common log_level
|
||||
config_get log_max_days common log_max_days
|
||||
config_get http_proxy common http_proxy
|
||||
config_get protocol common protocol
|
||||
config_get time common time
|
||||
|
||||
mkdir -p /var/etc/frp
|
||||
[ ! -f "$LOGFILE" ] && touch $LOGFILE
|
||||
|
||||
[ ! -f "/usr/bin/frpc" ] && download_binary
|
||||
[ ! -f "/usr/bin/frpc" ] && logger -t Frp 'Download frpc failed, please retry.' && exit 0
|
||||
|
||||
local tmpconf="/var/etc/frp/frpc.conf"
|
||||
|
||||
echo "[common]" >$tmpconf
|
||||
echo "server_addr=${server_addr}" >>$tmpconf
|
||||
echo "server_port=${server_port}" >>$tmpconf
|
||||
echo "privilege_token=${privilege_token}" >>$tmpconf
|
||||
echo "log_level=${log_level}" >>$tmpconf
|
||||
echo "log_max_days=${log_max_days}" >>$tmpconf
|
||||
echo "protocol=${protocol}" >>$tmpconf
|
||||
echo "log_file=$LOGFILE" >>$tmpconf
|
||||
[ -n "$http_proxy" ] && echo "http_proxy=$http_proxy" >>$tmpconf
|
||||
[ -n "$pool_count" ] && echo "pool_count=$pool_count" >>$tmpconf
|
||||
|
||||
config_load "frp"
|
||||
frp_write_bool tcp_mux common 1
|
||||
frp_write_bool login_fail_exit common 1
|
||||
config_foreach conf_proxy_add proxy "$tmpconf"
|
||||
|
||||
[ "$(cat "$tmpconf" | grep -c "type=")" -gt 0 ] || (echo_date "frp服务启动失败,请首先添加服务列表!" && exit 0)
|
||||
logger -t FRPC 'Starting frp service'
|
||||
SERVICE_DAEMONIZE=1 \
|
||||
service_start /usr/bin/frpc -c $tmpconf
|
||||
|
||||
[ "$time" -gt 0 ] && frp_add_cru $time
|
||||
[ -z "$(pgrep /usr/bin/frpc)" ] && echo_date "frp服务启动失败,请检查服务端 “TCP多路复用(tcp_mux)”设置,确保与客户端完全一致!"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
stop() {
|
||||
frp_del_cru
|
||||
if [ -n "`pidof frpc`" ]; then
|
||||
logger -t FRPC 'Shutting down frp service'
|
||||
service_stop /usr/bin/frpc
|
||||
Reduce_Log $LOGFILE
|
||||
fi
|
||||
return 0
|
||||
}
|
11
package/lean/luci-app-frpc/root/etc/uci-defaults/luci-frp
Executable file
11
package/lean/luci-app-frpc/root/etc/uci-defaults/luci-frp
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@frp[-1]
|
||||
add ucitrack frp
|
||||
set ucitrack.@frp[-1].init=frp
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
@ -9,7 +9,7 @@ LUCI_TITLE:=LuCI support for Shadowsocksr
|
||||
LUCI_DEPENDS:=+iptables-mod-tproxy +kmod-ipt-tproxy +ip +ipset-lists +shadowsocksr-libev-alt +pdnsd-alt +coreutils +coreutils-base64 +coreutils-nohup +dnsmasq-full
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=2.0
|
||||
PKG_RELEASE:=18
|
||||
PKG_RELEASE:=19
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
@ -83,7 +83,6 @@ alabout.com
|
||||
alasbarricadas.org
|
||||
alexlur.org
|
||||
aliengu.com
|
||||
aliyun.com
|
||||
alkasir.com
|
||||
allaboutalpha.com
|
||||
allgirlsallowed.org
|
||||
|
19
package/lean/luci-app-zerotier/Makefile
Normal file
19
package/lean/luci-app-zerotier/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI for Zerotier
|
||||
LUCI_DEPENDS:=+zerotier
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
module("luci.controller.zerotier",package.seeall)
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/zerotier")then
|
||||
return
|
||||
end
|
||||
entry({"admin","services","zerotier"},cbi("zerotier"),_("ZeroTier"),6).dependent=true
|
||||
entry({"admin","services","zerotier","status"},call("act_status")).leaf=true
|
||||
end
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("pgrep /usr/bin/zerotier-one >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
32
package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier.lua
Normal file
32
package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier.lua
Normal file
@ -0,0 +1,32 @@
|
||||
local e=require"nixio.fs"
|
||||
local e=luci.http
|
||||
local o=require"luci.model.network".init()
|
||||
local a,t,e,b
|
||||
a=Map("zerotier",translate("ZeroTier"),translate("ZeroTier 是一款可以创建P2P虚拟局域网的开源软件。"))
|
||||
a:section(SimpleSection).template = "zerotier/zerotier_status"
|
||||
t=a:section(NamedSection,"sample_config","zerotier",translate("全局设置"))
|
||||
t.anonymous=true
|
||||
t.addremove=false
|
||||
e=t:option(Flag,"enabled",translate("启用"))
|
||||
e.default=0
|
||||
e.rmempty=false
|
||||
e=t:option(ListValue,"interface",translate("接口"))
|
||||
for b,t in ipairs(o:get_networks())do
|
||||
if t:name()~="loopback" then e:value(t:name())end
|
||||
end
|
||||
-- e=t:option(Value,"start_delay",translate("延时启动"),translate("Units:seconds"))
|
||||
-- e.datatype="uinteger"
|
||||
-- e.default="0"
|
||||
-- e.rmempty=true
|
||||
e=t:option(DynamicList,"join",translate('ZeroTier 网络 ID'))
|
||||
e.password=true
|
||||
e.rmempty=false
|
||||
if nixio.fs.access("/etc/config/zerotier")then
|
||||
e=t:option(Button,"Configuration",translate("网络配置管理"))
|
||||
e.inputtitle=translate("打开网站")
|
||||
e.inputstyle="reload"
|
||||
e.write=function()
|
||||
luci.http.redirect("https://my.zerotier.com/")
|
||||
end
|
||||
end
|
||||
return a
|
@ -0,0 +1,23 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[zerotier]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('zerotier_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green><%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Running Status%></legend>
|
||||
<p id="zerotier_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
11
package/lean/luci-app-zerotier/root/etc/uci-defaults/40_luci-zerotier
Executable file
11
package/lean/luci-app-zerotier/root/etc/uci-defaults/40_luci-zerotier
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@zerotier[-1]
|
||||
add ucitrack zerotier
|
||||
set ucitrack.@zerotier[-1].init=zerotier
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
@ -47,6 +47,7 @@ define Package/busybox
|
||||
URL:=http://busybox.net/
|
||||
DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc +BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter
|
||||
MENU:=1
|
||||
PROVIDES:=ip
|
||||
ALTERNATIVES:=\
|
||||
$(call BUSYBOX_IF_ENABLED,KILL, 100:/bin/kill:/bin/busybox) \
|
||||
$(call BUSYBOX_IF_ENABLED,PS, 100:/bin/ps:/bin/busybox) \
|
||||
|
@ -223,8 +223,8 @@ CONFIG_ATH79_MACH_UBNT=y
|
||||
CONFIG_ATH79_MACH_UBNT_UNIFIAC=y
|
||||
CONFIG_ATH79_MACH_UBNT_XM=y
|
||||
CONFIG_ATH79_MACH_WEIO=y
|
||||
# CONFIG_ATH79_MACH_WI2A_AC200I is not set
|
||||
CONFIG_ATH79_MACH_WHR_HP_G300N=y
|
||||
# CONFIG_ATH79_MACH_WI2A_AC200I is not set
|
||||
CONFIG_ATH79_MACH_WLAE_AG300N=y
|
||||
CONFIG_ATH79_MACH_WLR8100=y
|
||||
CONFIG_ATH79_MACH_WNDAP360=y
|
||||
@ -374,6 +374,7 @@ CONFIG_MIPS_CLOCK_VSYSCALL=y
|
||||
CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER=y
|
||||
# CONFIG_MIPS_CMDLINE_FROM_DTB is not set
|
||||
# CONFIG_MIPS_ELF_APPENDED_DTB is not set
|
||||
CONFIG_MIPS_FPU_EMULATOR=y
|
||||
# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
|
||||
CONFIG_MIPS_L1_CACHE_SHIFT=5
|
||||
CONFIG_MIPS_MACHINE=y
|
||||
|
@ -126,6 +126,7 @@ CONFIG_MIPS_CLOCK_VSYSCALL=y
|
||||
# CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set
|
||||
CONFIG_MIPS_CMDLINE_FROM_DTB=y
|
||||
# CONFIG_MIPS_ELF_APPENDED_DTB is not set
|
||||
CONFIG_MIPS_FPU_EMULATOR=y
|
||||
# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
|
||||
CONFIG_MIPS_L1_CACHE_SHIFT=5
|
||||
# CONFIG_MIPS_MACHINE is not set
|
||||
@ -137,7 +138,6 @@ CONFIG_MODULES_USE_ELF_REL=y
|
||||
# CONFIG_MTD_CFI_INTELEXT is not set
|
||||
CONFIG_MTD_CMDLINE_PARTS=y
|
||||
CONFIG_MTD_M25P80=y
|
||||
CONFIG_MTD_NAND_MT7620=y
|
||||
CONFIG_MTD_PHYSMAP=y
|
||||
CONFIG_MTD_SPI_NOR=y
|
||||
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
|
||||
|
@ -5,6 +5,7 @@ CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
|
||||
# CONFIG_ARCH_HAS_GCOV_PROFILE_ALL is not set
|
||||
CONFIG_ARCH_HAS_RESET_CONTROLLER=y
|
||||
# CONFIG_ARCH_HAS_SG_CHAIN is not set
|
||||
CONFIG_ARCH_HAS_TICK_BROADCAST=y
|
||||
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
|
||||
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
|
||||
CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
|
||||
@ -64,6 +65,7 @@ CONFIG_EARLY_PRINTK=y
|
||||
CONFIG_FIXED_PHY=y
|
||||
CONFIG_GENERIC_ATOMIC64=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
|
||||
CONFIG_GENERIC_CMOS_UPDATE=y
|
||||
CONFIG_GENERIC_IO=y
|
||||
CONFIG_GENERIC_IRQ_CHIP=y
|
||||
@ -149,6 +151,7 @@ CONFIG_MIPS_CPS=y
|
||||
# CONFIG_MIPS_CPS_NS16550 is not set
|
||||
CONFIG_MIPS_CPU_SCACHE=y
|
||||
# CONFIG_MIPS_ELF_APPENDED_DTB is not set
|
||||
CONFIG_MIPS_FPU_EMULATOR=y
|
||||
CONFIG_MIPS_GIC=y
|
||||
# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
|
||||
CONFIG_MIPS_L1_CACHE_SHIFT=5
|
||||
@ -252,8 +255,8 @@ CONFIG_SPI_MASTER=y
|
||||
CONFIG_SPI_MT7621=y
|
||||
# CONFIG_SPI_RT2880 is not set
|
||||
CONFIG_SRCU=y
|
||||
CONFIG_SWCONFIG_LEDS=y
|
||||
CONFIG_SWCONFIG=y
|
||||
CONFIG_SWCONFIG_LEDS=y
|
||||
CONFIG_SWPHY=y
|
||||
CONFIG_SYNC_R4K=y
|
||||
CONFIG_SYSCTL_EXCEPTION_TRACE=y
|
||||
@ -280,6 +283,7 @@ CONFIG_USB_SUPPORT=y
|
||||
CONFIG_USE_OF=y
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
CONFIG_WEAK_ORDERING=y
|
||||
CONFIG_WEAK_REORDERING_BEYOND_LLSC=y
|
||||
CONFIG_XPS=y
|
||||
CONFIG_ZLIB_DEFLATE=y
|
||||
CONFIG_ZLIB_INFLATE=y
|
||||
|
Loading…
Reference in New Issue
Block a user