Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload openclash src #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ feeds:
uri: https://github.com/fw876/helloworld.git
branch: master
packages:
- luci-app-mwan3
- n2n
- n2n-utils
- n2n-edge
- n2n-supernode
- luci-app-n2n
- luci-app-openclash



Expand Down
17 changes: 17 additions & 0 deletions custom/luci-app-n2n/Makefile
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions custom/luci-app-n2n/luasrc/controller/n2n.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- 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
entry({"admin", "vpn", "n2n"}, cbi("n2n"), _("N2N VPN"), 45).dependent = true
entry({"admin", "vpn", "n2n", "status"}, call("act_status")).leaf = true
end

function act_status()
local e = {}
e.running = luci.sys.call("pgrep n2n-edge >/dev/null") == 0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
129 changes: 129 additions & 0 deletions custom/luci-app-n2n/luasrc/model/cbi/n2n.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
-- N2N VPN configuration page. Made by 981213

local fs = require "nixio.fs"

m = Map("n2n")
m.title = 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/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"))
s.description = 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
20 changes: 20 additions & 0 deletions custom/luci-app-n2n/luasrc/view/n2n/n2n_status.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=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>
93 changes: 93 additions & 0 deletions custom/luci-app-n2n/po/zh-cn/n2n.po
Original file line number Diff line number Diff line change
@@ -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-cn\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 "RUNNING"
msgstr "运行中"

msgid "NOT RUNNING"
msgstr "未运行"

msgid "N2N routes"
msgstr "路由表"

msgid "Static route for n2n interface"
msgstr "配置静态路由"

msgid "IP"
msgstr "IP"

msgid "Mask"
msgstr "掩码"

msgid "Gateway"
msgstr "网关"

msgid "Description"
msgstr "描述"
93 changes: 93 additions & 0 deletions custom/luci-app-n2n/po/zh_Hans/n2n.po
Original file line number Diff line number Diff line change
@@ -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-cn\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 "RUNNING"
msgstr "运行中"

msgid "NOT RUNNING"
msgstr "未运行"

msgid "N2N routes"
msgstr "路由表"

msgid "Static route for n2n interface"
msgstr "配置静态路由"

msgid "IP"
msgstr "IP"

msgid "Mask"
msgstr "掩码"

msgid "Gateway"
msgstr "网关"

msgid "Description"
msgstr "描述"
Loading