-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7f42775
Showing
20 changed files
with
2,274 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# | ||
# Copyright (C) 2016-2017 Jian Chang <[email protected]> | ||
# | ||
# This is free software, licensed under the GNU General Public License v3. | ||
# See /LICENSE for more information. | ||
# | ||
|
||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=luci-app-udp2raw | ||
PKG_VERSION:=1.0.0 | ||
PKG_RELEASE:=2 | ||
|
||
PKG_LICENSE:=GPLv3 | ||
PKG_LICENSE_FILES:=LICENSE | ||
PKG_MAINTAINER:=Jian Chang <[email protected]> | ||
|
||
include $(INCLUDE_DIR)/package.mk | ||
|
||
define Package/$(PKG_NAME) | ||
SECTION:=luci | ||
CATEGORY:=LuCI | ||
SUBMENU:=3. Applications | ||
TITLE:=LuCI Support for udp2raw-tunnel | ||
PKGARCH:=all | ||
DEPENDS:=+udp2raw-tunnel | ||
endef | ||
|
||
define Package/$(PKG_NAME)/description | ||
LuCI Support for udp2raw-tunnel. | ||
endef | ||
|
||
define Build/Prepare | ||
$(foreach po,$(wildcard ${CURDIR}/files/luci/i18n/*.po), \ | ||
po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));) | ||
endef | ||
|
||
define Build/Configure | ||
endef | ||
|
||
define Build/Compile | ||
endef | ||
|
||
define Package/$(PKG_NAME)/postinst | ||
#!/bin/sh | ||
if [ -z "$${IPKG_INSTROOT}" ]; then | ||
( . /etc/uci-defaults/luci-udp2raw ) && rm -f /etc/uci-defaults/luci-udp2raw | ||
fi | ||
exit 0 | ||
endef | ||
|
||
define Package/$(PKG_NAME)/conffiles | ||
/etc/config/udp2raw | ||
endef | ||
|
||
define Package/$(PKG_NAME)/install | ||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n | ||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/udp2raw.*.lmo $(1)/usr/lib/lua/luci/i18n/ | ||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller | ||
$(INSTALL_DATA) ./files/luci/controller/*.lua $(1)/usr/lib/lua/luci/controller/ | ||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/udp2raw | ||
$(INSTALL_DATA) ./files/luci/model/cbi/udp2raw/*.lua $(1)/usr/lib/lua/luci/model/cbi/udp2raw/ | ||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/udp2raw | ||
$(INSTALL_DATA) ./files/luci/view/udp2raw/*.htm $(1)/usr/lib/lua/luci/view/udp2raw/ | ||
$(INSTALL_DIR) $(1)/etc/config | ||
$(INSTALL_CONF) ./files/root/etc/config/udp2raw $(1)/etc/config/udp2raw | ||
$(INSTALL_DIR) $(1)/etc/init.d | ||
$(INSTALL_BIN) ./files/root/etc/init.d/udp2raw $(1)/etc/init.d/udp2raw | ||
$(INSTALL_DIR) $(1)/etc/uci-defaults | ||
$(INSTALL_BIN) ./files/root/etc/uci-defaults/luci-udp2raw $(1)/etc/uci-defaults/luci-udp2raw | ||
endef | ||
|
||
$(eval $(call BuildPackage,$(PKG_NAME))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# luci-app-udp2raw | ||
适用于 OpenWRT/LEDE 的 udp2raw-tunnel LuCI 控制界面 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module("luci.controller.udp2raw", package.seeall) | ||
|
||
function index() | ||
if not nixio.fs.access("/etc/config/udp2raw") then | ||
return | ||
end | ||
|
||
entry({"admin", "services", "udp2raw"}, | ||
firstchild(), _("udp2raw-tunnel")).dependent = false | ||
|
||
entry({"admin", "services", "udp2raw", "general"}, | ||
cbi("udp2raw/general"), _("Settings"), 1) | ||
|
||
entry({"admin", "services", "udp2raw", "servers"}, | ||
arcombine(cbi("udp2raw/servers"), cbi("udp2raw/servers-details")), | ||
_("Servers Manage"), 2).leaf = true | ||
|
||
entry({"admin", "services", "udp2raw", "status"}, call("action_status")) | ||
end | ||
|
||
local function is_running(name) | ||
return luci.sys.call("pidof %s >/dev/null" %{name}) == 0 | ||
end | ||
|
||
function action_status() | ||
luci.http.prepare_content("application/json") | ||
luci.http.write_json({ | ||
running = is_running("udp2raw") | ||
}) | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
msgid "" | ||
msgstr "Content-Type: text/plain; charset=UTF-8\n" | ||
|
||
msgid "udp2raw-tunnel" | ||
msgstr "udp2raw 隧道" | ||
|
||
msgid "Settings" | ||
msgstr "设置" | ||
|
||
msgid "Servers Manage" | ||
msgstr "服务器管理" | ||
|
||
msgid "Running Status" | ||
msgstr "运行状态" | ||
|
||
msgid "Binary Version" | ||
msgstr "文件版本" | ||
|
||
msgid "Build Time" | ||
msgstr "编译时间" | ||
|
||
msgid "Invalid Binary File." | ||
msgstr "可执行文件无效。" | ||
|
||
msgid "RUNNING" | ||
msgstr "运行中" | ||
|
||
msgid "NOT RUNNING" | ||
msgstr "未运行" | ||
|
||
msgid "General Settings" | ||
msgstr "基本设置" | ||
|
||
msgid "Server" | ||
msgstr "服务器" | ||
|
||
msgid "Disable" | ||
msgstr "停用" | ||
|
||
msgid "Run Daemon as User" | ||
msgstr "以该用户启动" | ||
|
||
msgid "Alias" | ||
msgstr "别名" | ||
|
||
msgid "None" | ||
msgstr "无" | ||
|
||
msgid "Server Address" | ||
msgstr "服务器地址" | ||
|
||
msgid "Listen Address" | ||
msgstr "监听地址" | ||
|
||
msgid "Edit Server" | ||
msgstr "编辑服务器" | ||
|
||
msgid "Alias(optional)" | ||
msgstr "别名(可选)" | ||
|
||
msgid "Server Port" | ||
msgstr "服务器端口" | ||
|
||
msgid "Local Listen Host" | ||
msgstr "本地监听地址" | ||
|
||
msgid "Local Listen Port" | ||
msgstr "本地监听端口" | ||
|
||
msgid "Raw Mode" | ||
msgstr "Raw 方式" | ||
|
||
msgid "Password" | ||
msgstr "密码" | ||
|
||
msgid "Cipher Mode" | ||
msgstr "加密方式" | ||
|
||
msgid "Auth Mode" | ||
msgstr "验证方式" | ||
|
||
msgid "Auto Rule" | ||
msgstr "自动规则" | ||
|
||
msgid "Auto add (and delete) iptables rule." | ||
msgstr "自动添加/删除 iptables 规则。" | ||
|
||
msgid "Keep Rule" | ||
msgstr "保持规则" | ||
|
||
msgid "Monitor iptables and auto re-add if necessary." | ||
msgstr "定期检查 iptables 并在必要时重新添加规则。" | ||
|
||
msgid "seq Mode" | ||
msgstr "seq 模式" | ||
|
||
msgid "seq increase mode for faketcp." | ||
msgstr "用于 faketcp 的 seq 增加方式。" | ||
|
||
msgid "Lower Level" | ||
msgstr "" | ||
|
||
msgid "Send packets at OSI level 2, format: \"eth0#00:11:22:33:44:55\", or \"auto\"." | ||
msgstr "在 OSI 模型第二层发送数据包,格式:\"eth0#00:11:22:33:44:55\",或 \"auto\"。" | ||
|
||
msgid "Source-IP" | ||
msgstr "源IP" | ||
|
||
msgid "Force source-ip for Raw Socket." | ||
msgstr "在原始数据包中强制指定源IP。" | ||
|
||
msgid "Source-Port" | ||
msgstr "源端口" | ||
|
||
msgid "Force source-port for Raw Socket, TCP/UDP only." | ||
msgstr "在原始数据包中强制指定源端口,仅用于 TCP/UDP。" | ||
|
||
msgid "Log Level" | ||
msgstr "日志级别" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
local m, s, o | ||
local uci = luci.model.uci.cursor() | ||
local servers = {} | ||
|
||
local function has_bin(name) | ||
return luci.sys.call("command -v %s >/dev/null" %{name}) == 0 | ||
end | ||
|
||
if not has_bin("udp2raw") then | ||
return Map("udp2raw", "%s - %s" %{translate("udp2raw-tunnel"), | ||
translate("Settings")}, '<b style="color:red">udp2raw-tunnel binary file not found.</b>') | ||
end | ||
|
||
uci:foreach("udp2raw", "servers", function(s) | ||
if s.server_addr and s.server_port then | ||
servers[#servers+1] = {name = s[".name"], alias = s.alias or "%s:%s" %{s.server_addr, s.server_port}} | ||
end | ||
end) | ||
|
||
m = Map("udp2raw", "%s - %s" %{translate("udp2raw-tunnel"), translate("Settings")}) | ||
m:append(Template("udp2raw/status")) | ||
|
||
s = m:section(NamedSection, "general", "general", translate("General Settings")) | ||
s.anonymous = true | ||
s.addremove = false | ||
|
||
o = s:option(DynamicList, "server", translate("Server")) | ||
o.template = "udp2raw/dynamiclist" | ||
o:value("nil", translate("Disable")) | ||
for _, s in ipairs(servers) do o:value(s.name, s.alias) end | ||
o.default = "nil" | ||
o.rmempty = false | ||
|
||
o = s:option(ListValue, "daemon_user", translate("Run Daemon as User")) | ||
for u in luci.util.execi("cat /etc/passwd | cut -d ':' -f1") do o:value(u) end | ||
o.default = "root" | ||
o.rmempty = false | ||
|
||
return m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
local m, s, o | ||
local sid = arg[1] | ||
|
||
local raw_modes = { | ||
"faketcp", | ||
"udp", | ||
"icmp", | ||
} | ||
|
||
local cipher_modes = { | ||
"aes128cbc", | ||
"xor", | ||
"none", | ||
} | ||
|
||
local auth_modes = { | ||
"md5", | ||
"crc32", | ||
"simple", | ||
"none", | ||
} | ||
|
||
m = Map("udp2raw", "%s - %s" %{translate("udp2raw-tunnel"), translate("Edit Server")}) | ||
m.redirect = luci.dispatcher.build_url("admin/services/udp2raw/servers") | ||
m.sid = sid | ||
|
||
if m.uci:get("udp2raw", sid) ~= "servers" then | ||
luci.http.redirect(m.redirect) | ||
return | ||
end | ||
|
||
s = m:section(NamedSection, sid, "servers") | ||
s.anonymous = true | ||
s.addremove = false | ||
|
||
o = s:option(Value, "alias", translate("Alias(optional)")) | ||
|
||
o = s:option(Value, "server_addr", translate("Server")) | ||
o.datatype = "host" | ||
o.rmempty = false | ||
|
||
o = s:option(Value, "server_port", translate("Server Port")) | ||
o.datatype = "port" | ||
o.placeholder = "8080" | ||
|
||
o = s:option(Value, "listen_addr", translate("Local Listen Host")) | ||
o.datatype = "ipaddr" | ||
o.placeholder = "127.0.0.1" | ||
|
||
o = s:option(Value, "listen_port", translate("Local Listen Port")) | ||
o.datatype = "port" | ||
o.placeholder = "2080" | ||
|
||
o = s:option(ListValue, "raw_mode", translate("Raw Mode")) | ||
for _, v in ipairs(raw_modes) do o:value(v, v:lower()) end | ||
o.default = "faketcp" | ||
o.rmempty = false | ||
|
||
o = s:option(Value, "key", translate("Password")) | ||
o.password = true | ||
|
||
o = s:option(ListValue, "cipher_mode", translate("Cipher Mode")) | ||
for _, v in ipairs(cipher_modes) do o:value(v, v:lower()) end | ||
o.default = "aes128cbc" | ||
|
||
o = s:option(ListValue, "auth_mode", translate("Auth Mode")) | ||
for _, v in ipairs(auth_modes) do o:value(v, v:lower()) end | ||
o.default = "md5" | ||
|
||
o = s:option(Flag, "auto_rule", translate("Auto Rule"), translate("Auto add (and delete) iptables rule.")) | ||
o.enabled = "1" | ||
o.disabled = "0" | ||
o.default = "1" | ||
|
||
o = s:option(Flag, "keep_rule", translate("Keep Rule"), translate("Monitor iptables and auto re-add if necessary.")) | ||
o.enabled = "1" | ||
o.disabled = "0" | ||
o:depends("auto_rule", "1") | ||
|
||
o = s:option(Value, "seq_mode", translate("seq Mode"), translate("seq increase mode for faketcp.")) | ||
o.datatype = "range(0,4)" | ||
o.placeholder = "3" | ||
|
||
o = s:option(Value, "lower_level", translate("Lower Level"), translate("Send packets at OSI level 2, format: \"eth0#00:11:22:33:44:55\", or \"auto\".")) | ||
|
||
o = s:option(Value, "source_ip", translate("Source-IP"), translate("Force source-ip for Raw Socket.")) | ||
o.datatype = "ipaddr" | ||
|
||
o = s:option(Value, "source_port", translate("Source-Port"), translate("Force source-port for Raw Socket, TCP/UDP only.")) | ||
o.datatype = "port" | ||
|
||
o = s:option(Value, "log_level", translate("Log Level")) | ||
o.datatype = "range(0,6)" | ||
o.placeholder = "4" | ||
|
||
return m |
Oops, something went wrong.