From 74501038e42ba227899ed49596cc661345e93c67 Mon Sep 17 00:00:00 2001 From: Jian Chang Date: Fri, 3 Jul 2015 15:17:38 +0800 Subject: luci-app-shadowsocks-libev: add package This adds support for configuring shadowsocks-libev Signed-off-by: Jian Chang --- applications/luci-app-shadowsocks-libev/Makefile | 14 +++ .../luasrc/controller/shadowsocks-libev.lua | 12 ++ .../luasrc/model/cbi/shadowsocks-libev.lua | 127 +++++++++++++++++++++ .../po/templates/shadowsocks-libev.pot | 74 ++++++++++++ .../po/zh-cn/shadowsocks-libev.po | 85 ++++++++++++++ .../root/etc/uci-defaults/luci-shadowsocks-libev | 11 ++ 6 files changed, 323 insertions(+) create mode 100644 applications/luci-app-shadowsocks-libev/Makefile create mode 100644 applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua create mode 100644 applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev.lua create mode 100644 applications/luci-app-shadowsocks-libev/po/templates/shadowsocks-libev.pot create mode 100644 applications/luci-app-shadowsocks-libev/po/zh-cn/shadowsocks-libev.po create mode 100644 applications/luci-app-shadowsocks-libev/root/etc/uci-defaults/luci-shadowsocks-libev (limited to 'applications/luci-app-shadowsocks-libev') diff --git a/applications/luci-app-shadowsocks-libev/Makefile b/applications/luci-app-shadowsocks-libev/Makefile new file mode 100644 index 000000000..848a5c831 --- /dev/null +++ b/applications/luci-app-shadowsocks-libev/Makefile @@ -0,0 +1,14 @@ +# +# 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 Support for Shadowsocks-libev +LUCI_DEPENDS:= + +include ../../luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua b/applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua new file mode 100644 index 000000000..ae968168f --- /dev/null +++ b/applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua @@ -0,0 +1,12 @@ +-- Copyright 2015 Jian Chang +-- Licensed to the public under the Apache License 2.0. + +module("luci.controller.shadowsocks-libev", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/shadowsocks-libev") then + return + end + + entry({"admin", "services", "shadowsocks-libev"}, cbi("shadowsocks-libev"), _("ShadowSocks-libev"), 74).dependent = true +end diff --git a/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev.lua b/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev.lua new file mode 100644 index 000000000..0b88f5a0f --- /dev/null +++ b/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev.lua @@ -0,0 +1,127 @@ +-- Copyright 2015 Jian Chang +-- Licensed to the public under the Apache License 2.0. + +local m, s, o, e, a + +if luci.sys.call("pidof ss-redir >/dev/null") == 0 then + m = Map("shadowsocks-libev", translate("ShadowSocks-libev"), translate("ShadowSocks-libev is running")) +else + m = Map("shadowsocks-libev", translate("ShadowSocks-libev"), translate("ShadowSocks-libev is not running")) +end + +-- Global Setting +s = m:section(TypedSection, "shadowsocks-libev", translate("Global Setting")) +s.anonymous = true + +o = s:option(Flag, "enable", translate("Enable")) +o.default = 1 +o.rmempty = false + +o = s:option(Value, "server", translate("Server Address")) +o.datatype = "host" +o.rmempty = false + +o = s:option(Value, "server_port", translate("Server Port")) +o.datatype = "port" +o.rmempty = false + +o = s:option(Value, "local_port", translate("Local Port")) +o.datatype = "port" +o.default = 1080 +o.rmempty = false + +o = s:option(Value, "timeout", translate("Connection Timeout")) +o.datatype = "uinteger" +o.default = 60 +o.rmempty = false + +o = s:option(Value, "password", translate("Password")) +o.password = true +o.rmempty = false + +e = { + "table", + "rc4", + "rc4-md5", + "aes-128-cfb", + "aes-192-cfb", + "aes-256-cfb", + "bf-cfb", + "camellia-128-cfb", + "camellia-192-cfb", + "camellia-256-cfb", + "cast5-cfb", + "des-cfb", + "idea-cfb", + "rc2-cfb", + "seed-cfb", + "salsa20", + "chacha20", +} + +o = s:option(ListValue, "encrypt_method", translate("Encrypt Method")) +for i,v in ipairs(e) do + o:value(v) +end +o.rmempty = false + +-- Proxy Setting +s = m:section(TypedSection, "shadowsocks-libev", translate("Proxy Setting")) +s.anonymous = true + +o = s:option(ListValue, "udp_relay", translate("Proxy Protocol")) +o:value("0", translate("TCP only")) +o:value("1", translate("TCP+UDP")) +o.default = 1 +o.rmempty = false + +o = s:option(Value, "ignore_list", translate("Ignore List")) +o:value("/dev/null", translate("Disabled")) +o.default = "/dev/null" +o.rmempty = false + +-- UDP Forward +s = m:section(TypedSection, "shadowsocks-libev", translate("UDP Forward")) +s.anonymous = true + +o = s:option(Flag, "tunnel_enable", translate("Enable")) +o.default = 1 +o.rmempty = false + +o = s:option(Value, "tunnel_port", translate("UDP Local Port")) +o.datatype = "port" +o.default = 5300 + +o = s:option(Value, "tunnel_forward", translate("Forwarding Tunnel")) +o.default = "8.8.4.4:53" + +-- Access Control +s = m:section(TypedSection, "shadowsocks-libev", translate("Access Control")) +s.anonymous = true + +s:tab("lan_ac", translate("LAN")) + +o = s:taboption("lan_ac", ListValue, "lan_ac_mode", translate("Access Control")) +o:value("0", translate("Disabled")) +o:value("1", translate("Allow listed only")) +o:value("2", translate("Allow all except listed")) +o.default = 0 +o.rmempty = false + +a = luci.sys.net.arptable() or {} + +o = s:taboption("lan_ac", DynamicList, "lan_ac_ip", translate("LAN IP List")) +o.datatype = "ipaddr" +for i,v in ipairs(a) do + o:value(v["IP address"]) +end + +s:tab("wan_ac", translate("WAN")) + +o = s:taboption("wan_ac", DynamicList, "wan_bp_ip", translate("Bypassed IP")) +o.datatype = "ip4addr" + +o = s:taboption("wan_ac", DynamicList, "wan_fw_ip", translate("Forwarded IP")) +o.datatype = "ip4addr" + +return m diff --git a/applications/luci-app-shadowsocks-libev/po/templates/shadowsocks-libev.pot b/applications/luci-app-shadowsocks-libev/po/templates/shadowsocks-libev.pot new file mode 100644 index 000000000..a02608e1e --- /dev/null +++ b/applications/luci-app-shadowsocks-libev/po/templates/shadowsocks-libev.pot @@ -0,0 +1,74 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "ShadowSocks-libev" +msgstr "" + +msgid "ShadowSocks-libev is running" +msgstr "" + +msgid "ShadowSocks-libev is not running" +msgstr "" + +msgid "Global Setting" +msgstr "" + +msgid "Enable" +msgstr "" + +msgid "Server Address" +msgstr "" + +msgid "Server Port" +msgstr "" + +msgid "Local Port" +msgstr "" + +msgid "Connection Timeout" +msgstr "" + +msgid "Password" +msgstr "" + +msgid "Encrypt Method" +msgstr "" + +msgid "Proxy Setting" +msgstr "" + +msgid "Proxy Protocol" +msgstr "" + +msgid "Ignore List" +msgstr "" + +msgid "UDP Forward" +msgstr "" + +msgid "UDP Local Port" +msgstr "" + +msgid "Forwarding Tunnel" +msgstr "" + +msgid "Access Control" +msgstr "" + +msgid "Disabled" +msgstr "" + +msgid "Allow listed only" +msgstr "" + +msgid "Allow all except listed" +msgstr "" + +msgid "LAN IP List" +msgstr "" + +msgid "Bypassed IP" +msgstr "" + +msgid "Forwarded IP" +msgstr "" diff --git a/applications/luci-app-shadowsocks-libev/po/zh-cn/shadowsocks-libev.po b/applications/luci-app-shadowsocks-libev/po/zh-cn/shadowsocks-libev.po new file mode 100644 index 000000000..902f7a18a --- /dev/null +++ b/applications/luci-app-shadowsocks-libev/po/zh-cn/shadowsocks-libev.po @@ -0,0 +1,85 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-11-12 14:12+0800\n" +"PO-Revision-Date: 2015-07-02 14:26+0800\n" +"Last-Translator: Jian Chang \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" +"X-Generator: Pootle 2.0.6\n" + +msgid "ShadowSocks-libev" +msgstr "ShadowSocks-libev" + +msgid "ShadowSocks-libev is running" +msgstr "ShadowSocks-libev 运行中" + +msgid "ShadowSocks-libev is not running" +msgstr "ShadowSocks-libev 未运行" + +msgid "Global Setting" +msgstr "全局设置" + +msgid "Enable" +msgstr "启用" + +msgid "Server Address" +msgstr "服务器地址" + +msgid "Server Port" +msgstr "服务器端口" + +msgid "Local Port" +msgstr "本地端口" + +msgid "Connection Timeout" +msgstr "连接超时" + +msgid "Password" +msgstr "密码" + +msgid "Encrypt Method" +msgstr "加密方式" + +msgid "Proxy Setting" +msgstr "代理设置" + +msgid "Proxy Protocol" +msgstr "代理协议" + +msgid "Ignore List" +msgstr "忽略列表" + +msgid "UDP Forward" +msgstr "UDP转发" + +msgid "UDP Local Port" +msgstr "UDP本地端口" + +msgid "Forwarding Tunnel" +msgstr "UDP转发地址" + +msgid "Access Control" +msgstr "访问控制" + +msgid "Disabled" +msgstr "已禁用" + +msgid "Allow listed only" +msgstr "仅允许列表内" + +msgid "Allow all except listed" +msgstr "仅允许列表外" + +msgid "LAN IP List" +msgstr "内网IP列表" + +msgid "Bypassed IP" +msgstr "被忽略的IP" + +msgid "Forwarded IP" +msgstr "走代理的IP" diff --git a/applications/luci-app-shadowsocks-libev/root/etc/uci-defaults/luci-shadowsocks-libev b/applications/luci-app-shadowsocks-libev/root/etc/uci-defaults/luci-shadowsocks-libev new file mode 100644 index 000000000..6f30fa77b --- /dev/null +++ b/applications/luci-app-shadowsocks-libev/root/etc/uci-defaults/luci-shadowsocks-libev @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@shadowsocks-libev[-1] + add ucitrack shadowsocks-libev + set ucitrack.@shadowsocks-libev[-1].init=shadowsocks-libev + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 -- cgit v1.2.3