mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-19 14:13:30 +00:00
re-add and update n2n_v2 luci
This commit is contained in:
parent
4d2c8cbf62
commit
cdc4409877
17
package/lean/luci-app-n2n_v2/Makefile
Executable file
17
package/lean/luci-app-n2n_v2/Makefile
Executable 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_v2 VPN Configuration module
|
||||
LUCI_DEPENDS:=+n2n_v2
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
18
package/lean/luci-app-n2n_v2/luasrc/controller/n2n_v2.lua
Normal file
18
package/lean/luci-app-n2n_v2/luasrc/controller/n2n_v2.lua
Normal file
@ -0,0 +1,18 @@
|
||||
--[[
|
||||
N2N V2 Luci configuration page.Made by 981213
|
||||
]]--
|
||||
|
||||
module("luci.controller.n2n_v2", package.seeall)
|
||||
|
||||
function index()
|
||||
|
||||
if not nixio.fs.access("/etc/config/n2n_v2") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
|
||||
|
||||
local page
|
||||
page = entry({"admin", "vpn", "n2n_v2"}, cbi("n2n_v2"), _("N2N v2 VPN"), 45)
|
||||
page.dependent = true
|
||||
end
|
57
package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua
Normal file
57
package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua
Normal file
@ -0,0 +1,57 @@
|
||||
--[[
|
||||
--N2N VPN(V2) configuration page. Made by 981213
|
||||
--
|
||||
]]--
|
||||
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
m = Map("n2n_v2", translate("N2N v2 VPN"),
|
||||
translatef("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."))
|
||||
|
||||
s = m:section(TypedSection, "edge", translate("N2N Edge Settings"))
|
||||
s.anonymous = 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
|
||||
|
||||
netmask = s:option(Value, "netmask", translate("Interface netmask"))
|
||||
netmask.optional = false
|
||||
|
||||
supernode = s:option(Value, "supernode", translate("Supernode IP address"))
|
||||
supernode.optional = false
|
||||
|
||||
port = s:option(Value, "port", translate("Supernode Port"))
|
||||
port.datatype = "range(0,65535)"
|
||||
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
|
||||
|
||||
s2 = m:section(TypedSection, "supernode", translate("N2N Supernode Settings"))
|
||||
s2.anonymous = true
|
||||
|
||||
switch = s2:option(Flag, "enabled", translate("Enable"))
|
||||
switch.rmempty = false
|
||||
|
||||
port = s2:option(Value, "port", translate("Port"))
|
||||
port.datatype = "range(0,65535)"
|
||||
port.optional = false
|
||||
|
||||
return m
|
||||
|
||||
|
54
package/lean/luci-app-n2n_v2/po/zh-cn/n2n_v2.po
Executable file
54
package/lean/luci-app-n2n_v2/po/zh-cn/n2n_v2.po
Executable file
@ -0,0 +1,54 @@
|
||||
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 IP address"
|
||||
msgstr "Supernode节点IP地址"
|
||||
|
||||
msgid "N2N Community name"
|
||||
msgstr "N2N网络组名称"
|
||||
|
||||
msgid "Enable packet forwarding"
|
||||
msgstr "启用数据包转发"
|
||||
|
||||
msgid "N2N Supernode Settings"
|
||||
msgstr "N2N Supernode节点设置"
|
||||
|
||||
msgid "Port"
|
||||
msgstr "端口"
|
||||
|
||||
msgid "Supernode Port"
|
||||
msgstr "Supernode节点端口"
|
||||
|
||||
msgid "Encryption key"
|
||||
msgstr "加密密钥"
|
11
package/lean/luci-app-n2n_v2/root/etc/uci-defaults/luci-n2n_v2
Executable file
11
package/lean/luci-app-n2n_v2/root/etc/uci-defaults/luci-n2n_v2
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@n2n_v2[-1]
|
||||
add ucitrack n2n_v2
|
||||
set ucitrack.@n2n_v2[-1].init=n2n_v2
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
53
package/lean/n2n_v2/Makefile
Normal file
53
package/lean/n2n_v2/Makefile
Normal file
@ -0,0 +1,53 @@
|
||||
#
|
||||
# Copyright (C) 2007-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=n2n_v2
|
||||
PKG_VERSION:=2.4
|
||||
PKG_RELEASE:=1
|
||||
PKG_REV=25563f31d9aba5f61b3e2fb42941b66dad1f531f
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REV).tar.bz2
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
PKG_SOURCE_URL:=https://github.com/ntop/n2n.git
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/n2n_v2
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=N2N VPN tunneling daemon(V2)
|
||||
URL:=http://www.ntop.org/n2n/
|
||||
SUBMENU:=VPN
|
||||
DEPENDS:=+libpthread +kmod-tun +libopenssl
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
INSTALL_PROG=":"
|
||||
endef
|
||||
|
||||
define Package/n2n_v2/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/edge $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/supernode $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/n2n_v2.config $(1)/etc/config/n2n_v2
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/n2n_v2.init $(1)/etc/init.d/n2n_v2
|
||||
endef
|
||||
|
||||
define Package/n2n_v2/conffiles
|
||||
/etc/config/n2n_v2
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,n2n_v2))
|
15
package/lean/n2n_v2/files/n2n_v2.config
Normal file
15
package/lean/n2n_v2/files/n2n_v2.config
Normal file
@ -0,0 +1,15 @@
|
||||
config edge
|
||||
option enabled '0'
|
||||
option tunname 'n2n_edge'
|
||||
option mode 'static'
|
||||
option ipaddr '10.0.0.100'
|
||||
option netmask '255.255.255.0'
|
||||
option supernode '1.2.3.4'
|
||||
option port '1234'
|
||||
option community 'example'
|
||||
option key 'password'
|
||||
option route '0'
|
||||
|
||||
config supernode
|
||||
option enabled '0'
|
||||
option port '1235'
|
62
package/lean/n2n_v2/files/n2n_v2.init
Normal file
62
package/lean/n2n_v2/files/n2n_v2.init
Normal file
@ -0,0 +1,62 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2008-2012 OpenWrt.org
|
||||
|
||||
START=90
|
||||
|
||||
start_instance() {
|
||||
local cfg="$1"
|
||||
|
||||
config_get type "$cfg" TYPE
|
||||
|
||||
case "$type" in
|
||||
edge)
|
||||
config_get_bool enabled "$cfg" 'enabled' '0'
|
||||
[ "$enabled" = "0" ] && return 1
|
||||
config_get tunname "$cfg" 'tunname'
|
||||
config_get mode "$cfg" 'mode'
|
||||
config_get ipaddr "$cfg" 'ipaddr'
|
||||
config_get netmask "$cfg" 'netmask'
|
||||
config_get supernode "$cfg" 'supernode'
|
||||
config_get port "$cfg" 'port'
|
||||
config_get community "$cfg" 'community'
|
||||
config_get key "$cfg" 'key'
|
||||
config_get_bool route "$cfg" 'route' '0'
|
||||
[ "$route" = "1" ] && args='-r'
|
||||
[ "$mode" = 'dhcp' ] && ipaddr='0.0.0.0'
|
||||
/usr/sbin/edge -d $tunname -a ${mode}:${ipaddr} -c $community $([ -n "$key" ] && echo -k $key) -s ${netmask} -l ${supernode}:${port} $args
|
||||
;;
|
||||
supernode)
|
||||
config_get_bool enabled "$cfg" 'enabled' '0'
|
||||
[ "$enabled" = "0" ] && return 1
|
||||
config_get port "$cfg" port
|
||||
/usr/sbin/supernode -l $port &
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
stop_instance() {
|
||||
local cfg="$1"
|
||||
|
||||
config_get type "$cfg" TYPE
|
||||
|
||||
case "$type" in
|
||||
edge)
|
||||
killall -9 edge
|
||||
;;
|
||||
supernode)
|
||||
killall -9 supernode
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
start() {
|
||||
config_load 'n2n_v2'
|
||||
config_foreach start_instance 'edge'
|
||||
config_foreach start_instance 'supernode'
|
||||
}
|
||||
|
||||
stop() {
|
||||
config_load 'n2n_v2'
|
||||
killall -9 edge
|
||||
killall -9 supernode
|
||||
}
|
Loading…
Reference in New Issue
Block a user