diff --git a/config/Config-images.in b/config/Config-images.in index 89ff1450a..dcaf6fb0b 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -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" diff --git a/package/lean/frpc/Makefile b/package/lean/frpc/Makefile new file mode 100644 index 000000000..9dd899356 --- /dev/null +++ b/package/lean/frpc/Makefile @@ -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))) diff --git a/package/lean/frpc/files/7620n/frpc b/package/lean/frpc/files/7620n/frpc new file mode 100755 index 000000000..eedf6eba4 Binary files /dev/null and b/package/lean/frpc/files/7620n/frpc differ diff --git a/package/lean/frpc/files/ar71xx/frpc b/package/lean/frpc/files/ar71xx/frpc new file mode 100755 index 000000000..2be33146a Binary files /dev/null and b/package/lean/frpc/files/ar71xx/frpc differ diff --git a/package/lean/frpc/files/arm/frpc b/package/lean/frpc/files/arm/frpc new file mode 100755 index 000000000..ee4886389 Binary files /dev/null and b/package/lean/frpc/files/arm/frpc differ diff --git a/package/lean/frpc/files/x86/frpc b/package/lean/frpc/files/x86/frpc new file mode 100755 index 000000000..b60646ec3 Binary files /dev/null and b/package/lean/frpc/files/x86/frpc differ diff --git a/package/lean/frpc/files/x86_64/frpc b/package/lean/frpc/files/x86_64/frpc new file mode 100755 index 000000000..711a9647f Binary files /dev/null and b/package/lean/frpc/files/x86_64/frpc differ diff --git a/package/lean/luci-app-frpc/Makefile b/package/lean/luci-app-frpc/Makefile new file mode 100644 index 000000000..fe9d38da0 --- /dev/null +++ b/package/lean/luci-app-frpc/Makefile @@ -0,0 +1,19 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# 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 + + diff --git a/package/lean/luci-app-frpc/luasrc/controller/frp.lua b/package/lean/luci-app-frpc/luasrc/controller/frp.lua new file mode 100644 index 000000000..a6d2ff561 --- /dev/null +++ b/package/lean/luci-app-frpc/luasrc/controller/frp.lua @@ -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 diff --git a/package/lean/luci-app-frpc/luasrc/i18n/frp.zh-cn.lmo b/package/lean/luci-app-frpc/luasrc/i18n/frp.zh-cn.lmo new file mode 100644 index 000000000..f3b95348f Binary files /dev/null and b/package/lean/luci-app-frpc/luasrc/i18n/frp.zh-cn.lmo differ diff --git a/package/lean/luci-app-frpc/luasrc/model/cbi/frp/config.lua b/package/lean/luci-app-frpc/luasrc/model/cbi/frp/config.lua new file mode 100644 index 000000000..e9499c8c9 --- /dev/null +++ b/package/lean/luci-app-frpc/luasrc/model/cbi/frp/config.lua @@ -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("Please ensure the remark name is unique.")) +e.rmempty = false +return a diff --git a/package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua b/package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua new file mode 100644 index 000000000..303979392 --- /dev/null +++ b/package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua @@ -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 diff --git a/package/lean/luci-app-frpc/luasrc/view/frp/frp_status.htm b/package/lean/luci-app-frpc/luasrc/view/frp/frp_status.htm new file mode 100644 index 000000000..a34467172 --- /dev/null +++ b/package/lean/luci-app-frpc/luasrc/view/frp/frp_status.htm @@ -0,0 +1,23 @@ + + +
+ <%:Frp Status%> +

+ <%:Collecting data...%> +

+
diff --git a/package/lean/luci-app-frpc/root/etc/config/frp b/package/lean/luci-app-frpc/root/etc/config/frp new file mode 100644 index 000000000..2015955e8 --- /dev/null +++ b/package/lean/luci-app-frpc/root/etc/config/frp @@ -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' diff --git a/package/lean/luci-app-frpc/root/etc/init.d/frp b/package/lean/luci-app-frpc/root/etc/init.d/frp new file mode 100755 index 000000000..426b6e9d2 --- /dev/null +++ b/package/lean/luci-app-frpc/root/etc/init.d/frp @@ -0,0 +1,214 @@ +#!/bin/sh /etc/rc.common +#Author: monokoo +#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 +} diff --git a/package/lean/luci-app-frpc/root/etc/uci-defaults/luci-frp b/package/lean/luci-app-frpc/root/etc/uci-defaults/luci-frp new file mode 100755 index 000000000..46016e1c5 --- /dev/null +++ b/package/lean/luci-app-frpc/root/etc/uci-defaults/luci-frp @@ -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 diff --git a/package/lean/luci-app-shadowsocksr-pro/Makefile b/package/lean/luci-app-shadowsocksr-pro/Makefile index d5b2b1543..79970eac8 100644 --- a/package/lean/luci-app-shadowsocksr-pro/Makefile +++ b/package/lean/luci-app-shadowsocksr-pro/Makefile @@ -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 diff --git a/package/lean/luci-app-shadowsocksr-pro/root/etc/shadowsocksr/base-gfwlist.txt b/package/lean/luci-app-shadowsocksr-pro/root/etc/shadowsocksr/base-gfwlist.txt index 75277f6c0..9d63f387a 100644 --- a/package/lean/luci-app-shadowsocksr-pro/root/etc/shadowsocksr/base-gfwlist.txt +++ b/package/lean/luci-app-shadowsocksr-pro/root/etc/shadowsocksr/base-gfwlist.txt @@ -83,7 +83,6 @@ alabout.com alasbarricadas.org alexlur.org aliengu.com -aliyun.com alkasir.com allaboutalpha.com allgirlsallowed.org diff --git a/package/lean/luci-app-zerotier/Makefile b/package/lean/luci-app-zerotier/Makefile new file mode 100644 index 000000000..4a6e60a6c --- /dev/null +++ b/package/lean/luci-app-zerotier/Makefile @@ -0,0 +1,19 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# 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 + + diff --git a/package/lean/luci-app-zerotier/luasrc/controller/zerotier.lua b/package/lean/luci-app-zerotier/luasrc/controller/zerotier.lua new file mode 100644 index 000000000..b6edcf77f --- /dev/null +++ b/package/lean/luci-app-zerotier/luasrc/controller/zerotier.lua @@ -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 diff --git a/package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier.lua b/package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier.lua new file mode 100644 index 000000000..21414ddc5 --- /dev/null +++ b/package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier.lua @@ -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 diff --git a/package/lean/luci-app-zerotier/luasrc/view/zerotier/zerotier_status.htm b/package/lean/luci-app-zerotier/luasrc/view/zerotier/zerotier_status.htm new file mode 100644 index 000000000..a4dfa39ec --- /dev/null +++ b/package/lean/luci-app-zerotier/luasrc/view/zerotier/zerotier_status.htm @@ -0,0 +1,23 @@ + + +
+ <%:Running Status%> +

+ <%:Collecting data...%> +

+
diff --git a/package/lean/luci-app-zerotier/root/etc/uci-defaults/40_luci-zerotier b/package/lean/luci-app-zerotier/root/etc/uci-defaults/40_luci-zerotier new file mode 100755 index 000000000..06f02e802 --- /dev/null +++ b/package/lean/luci-app-zerotier/root/etc/uci-defaults/40_luci-zerotier @@ -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 diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 941e82835..35f63d9a7 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -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) \ diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4 index 4793bf4de..1f4d9f4c3 100644 --- a/target/linux/ar71xx/config-4.4 +++ b/target/linux/ar71xx/config-4.4 @@ -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 diff --git a/target/linux/ramips/mt7620/config-4.9 b/target/linux/ramips/mt7620/config-4.9 index dc3c8fcc0..52c05185e 100644 --- a/target/linux/ramips/mt7620/config-4.9 +++ b/target/linux/ramips/mt7620/config-4.9 @@ -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 diff --git a/target/linux/ramips/mt7621/config-4.9 b/target/linux/ramips/mt7621/config-4.9 index f9765edaf..ce8ba450c 100644 --- a/target/linux/ramips/mt7621/config-4.9 +++ b/target/linux/ramips/mt7621/config-4.9 @@ -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