🗽 Sync 2022-06-30 09:03:47

This commit is contained in:
github-actions[bot] 2022-06-30 09:03:47 +08:00
parent 663d5bf5b7
commit f2afb81fab
11 changed files with 495 additions and 96 deletions

View File

@ -200,10 +200,10 @@ msgid "subdomain_host must be configured in server: frps in advance."
msgstr "使用子域名时,必须预先在服务端配置主域名(subdomain_host)参数。"
msgid "STCP Role"
msgstr "SFTP 服务类型"
msgstr "STCP 服务类型"
msgid "XTCP Role"
msgstr "XFTP 服务类型"
msgstr "XTCP 服务类型"
msgid "Use Plugin"
msgstr "使用插件"
@ -212,16 +212,16 @@ msgid "If plugin is defined, local_ip and local_port is useless, plugin will han
msgstr "使用插件使用插件模式时,本地 IP 地址和端口无需配置,插件将会处理来自服务端的链接请求。"
msgid "STCP Screct Key"
msgstr "SFTP 密钥"
msgstr "STCP 密钥"
msgid "STCP Server Name"
msgstr "SFTP 服务名称"
msgstr "STCP 服务名称"
msgid "XTCP Screct Key"
msgstr "SFTP 密钥"
msgstr "XTCP 密钥"
msgid "XTCP Server Name"
msgstr "SFTP 服务名称"
msgstr "XTCP 服务名称"
msgid "Enable URL routing"
msgstr "启用 URL 路由"

View File

@ -75,10 +75,8 @@ conf_proxy_add() {
[ -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
[ -z "$xtcp_role" ] && [ -n "$local_ip" ] && echo "local_ip=$local_ip" >>$tmpconf
[ -z "$xtcp_role" ] && [ -n "$local_port" ] && echo "local_port=$local_port" >>$tmpconf
[ -z "$stcp_role" ] && [ -z "$xtcp_role" ] && [ -n "$local_ip" ] && echo "local_ip=$local_ip" >>$tmpconf
[ -z "$stcp_role" ] && [ -z "$xtcp_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

File diff suppressed because it is too large Load Diff

17
luci-app-n2n/Makefile Normal file
View File

@ -0,0 +1,17 @@
#
# 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:=n2n VPN Configuration module
LUCI_DEPENDS:=+n2n
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-n2n
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,24 @@
-- N2N Luci configuration page. Made by 981213
module("luci.controller.n2n", package.seeall)
function index()
if not nixio.fs.access("/etc/config/n2n") then
return
end
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
local page = entry({"admin", "vpn", "n2n"}, cbi("n2n"), _("N2N VPN"), 45)
page.dependent = true
page.acl_depends = { "luci-app-n2n" }
entry({"admin", "vpn", "n2n", "status"}, call("n2n_status")).leaf = true
end
function n2n_status()
local status = {}
status.running = luci.sys.call("pgrep n2n-edge >/dev/null")==0
luci.http.prepare_content("application/json")
luci.http.write_json(status)
end

View File

@ -0,0 +1,128 @@
-- N2N VPN configuration page. Made by 981213
local fs = require "nixio.fs"
m = Map("n2n", translate("N2N VPN"))
m.description = translate("n2n is a layer-two peer-to-peer virtual private network (VPN) which allows users to exploit features typical of P2P applications at network instead of application level.")
-- Basic config
-- edge
m:section(SimpleSection).template = "n2n/status"
s = m:section(TypedSection, "edge", translate("N2N Edge Settings"))
s.anonymous = true
s.addremove = true
switch = s:option(Flag, "enabled", translate("Enable"))
switch.rmempty = false
tunname = s:option(Value, "tunname", translate("TUN desvice name"))
tunname.optional = false
mode = s:option(ListValue, "mode", translate("Interface mode"))
mode:value("dhcp")
mode:value("static")
ipaddr = s:option(Value, "ipaddr", translate("Interface IP address"))
ipaddr.optional = false
ipaddr.datatype = "ip4addr"
ipaddr:depends("mode", "static")
prefix = s:option(Value, "prefix", translate("Interface netmask"))
prefix:value("8", "8 (255.0.0.0)")
prefix:value("16", "16 (255.255.0.0)")
prefix:value("24", "24 (255.255.255.0)")
prefix:value("28", "28 (255.255.255.240)")
prefix.optional = false
prefix.datatype = "range(0,32)"
prefix:depends("mode", "static")
mtu = s:option(Value, "mtu", translate("MTU"))
mtu.datatype = "range(1,1500)"
mtu.optional = false
supernode = s:option(Value, "supernode", translate("Supernode Host"))
supernode.datatype = "host"
supernode.optional = false
supernode.rmempty = false
port = s:option(Value, "port", translate("Supernode Port"))
port.datatype = "port"
port.optional = false
port.rmempty = false
second_supernode = s:option(Value, "second_supernode", translate("Second Supernode Host"))
second_supernode.datatype = "host"
second_supernode.optional = false
second_port = s:option(Value, "second_port", translate("Second Supernode Port"))
second_port.datatype = "port"
second_port.optional = false
community = s:option(Value, "community", translate("N2N Community name"))
community.optional = false
s:option(Value, "key", translate("Encryption key"))
route = s:option(Flag, "route", translate("Enable packet forwarding"))
route.rmempty = false
masquerade = s:option(Flag, "masquerade", translate("Enable IP masquerade"))
masquerade.description = translate("Make packets from LAN to other edge nodes appear to be sent from the tunnel IP. This can make setting up your firewall easier")
masquerade.orientation = "horizontal"
masquerade:depends("route", 1)
masquerade.rmempty = false
-- supernode
s = m:section(TypedSection, "supernode", translate("N2N Supernode Settings"))
s.anonymous = true
s.addremove = true
switch = s:option(Flag, "enabled", translate("Enable"))
switch.rmempty = false
port = s:option(Value, "port", translate("Port"))
port.datatype = "port"
port.optional = false
subnet = s:option(Value, "subnet", translate("DHCP Subnet"))
subnet.optional = false
-- Static route
s = m:section(TypedSection, "route", translate("N2N routes"),
translate("Static route for n2n interface"))
s.anonymous = true
s.addremove = true
s.template = "cbi/tblsection"
---- enable
switch = s:option(Flag, "enabled", translate("Enable"))
switch.rmempty = false
---- IP address
o = s:option(Value, "ip", translate("IP"))
o.optional = false
o.datatype = "ip4addr"
o.rmempty = false
---- IP mask
o = s:option(Value, "mask", translate("Mask"))
o:value("8", "8 (255.0.0.0)")
o:value("16", "16 (255.255.0.0)")
o:value("24", "24 (255.255.255.0)")
o:value("28", "28 (255.255.255.240)")
o.optional = false
o.datatype = "range(0,32)"
o.default = "24"
---- Gateway
o = s:option(Value, "gw", translate("Gateway"))
o.optional = false
o.datatype = "ip4addr"
o.rmempty = false
---- Description
o = s:option(Value, "desc", translate("Description"))
o.optional = false
return m

View File

@ -0,0 +1,20 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(5, '<%=url([[admin]], [[vpn]], [[n2n]], [[status]])%>', null,
function(x, data) {
var status = document.getElementById('n2n_status');
if (data && status) {
if (data.running) {
status.innerHTML = "<em><b style='color:green;'>N2N VPN <%:RUNNING%></b></em>";
} else {
status.innerHTML = "<em><b style='color:red;'>N2N VPN <%:NOT RUNNING%></b></em>";
}
}
}
);
//]]>
</script>
<fieldset class="cbi-section">
<p id="n2n_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

1
luci-app-n2n/po/zh-cn Symbolic link
View File

@ -0,0 +1 @@
zh_Hans

View File

@ -0,0 +1,93 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-01\n"
"PO-Revision-Date: 2014-10-01\n"
"Last-Translator: 981213 <gch981213@gmail.com>\n"
"Language: zh_Hans\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
msgid "n2n is a layer-two peer-to-peer virtual private network (VPN) which allows users to exploit features typical of P2P applications at network instead of application level."
msgstr "N2N是一个第二层点对点VPN程序它可以让用户在网络层而不是应用层使用一些点对点服务。"
msgid "N2N Edge Settings"
msgstr "N2N Edge节点设置"
msgid "TUN desvice name"
msgstr "隧道设备名称"
msgid "Enable"
msgstr "启用"
msgid "Interface mode"
msgstr "接口模式"
msgid "Interface IP address"
msgstr "接口IP地址"
msgid "Interface netmask"
msgstr "接口子网掩码"
msgid "Supernode Host"
msgstr "Supernode节点地址"
msgid "Second Supernode Host"
msgstr "第二Supernode节点地址"
msgid "N2N Community name"
msgstr "N2N网络组名称"
msgid "Enable packet forwarding"
msgstr "启用数据包转发"
msgid "Enable IP masquerade"
msgstr "IP动态伪装"
msgid "Make packets from LAN to other edge nodes appear to be sent from the tunnel IP. This can make setting up your firewall easier"
msgstr "使局域网发往其他边缘节点的数据包看起来像是从接口IP发出的。这也许能帮助你方便地设置防火墙"
msgid "N2N Supernode Settings"
msgstr "N2N Supernode节点设置"
msgid "Port"
msgstr "端口"
msgid "DHCP Subnet"
msgstr "子网IP段"
msgid "Supernode Port"
msgstr "Supernode节点端口"
msgid "Second Supernode Port"
msgstr "第二Supernode节点端口"
msgid "Encryption key"
msgstr "加密密钥"
msgid "<b style='color:green;'>N2N VPN is running.</b>"
msgstr "<b style='color:green;'>N2N VPN 运行中</b>"
msgid "<b style='color:red;'>N2N VPN is not running.</b>"
msgstr "<b style='color:red;'>N2N VPN 未运行</b>"
msgid "N2N routes"
msgstr "路由表"
msgid "Static route for n2n interface"
msgstr "配置静态路由"
msgid "IP"
msgstr "IP"
msgid "Mask"
msgstr "掩码"
msgid "Gateway"
msgstr "网关"
msgid "Description"
msgstr "描述"

View File

@ -0,0 +1,11 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@n2n[-1]
add ucitrack n2n
set ucitrack.@n2n[-1].init=n2n
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,11 @@
{
"luci-app-n2n": {
"description": "Grant UCI access for luci-app-n2n",
"read": {
"uci": [ "n2n" ]
},
"write": {
"uci": [ "n2n" ]
}
}
}