diff --git a/LingTiGameAcc/Makefile b/LingTiGameAcc/Makefile new file mode 100644 index 000000000..792c19b38 --- /dev/null +++ b/LingTiGameAcc/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2015-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v3. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=LingTiGameAcc +PKG_VERSION:=2021 +PKG_RELEASE:=1.4.4 + +PKG_LICENSE:=GPLv3 +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=eSir Playground + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + CATEGORY:=eSir Playground + SUBMENU:=2. GameAcc + TITLE:=LingTi Game Accelerator + URL:=https://github.com/esirplayground/LingTiGameAcc + DEPENDS:=+kmod-tun +endef + +define Package/$(PKG_NAME)/description +LingTi Game Acc is a Game Accelerator which is paid service. +endef + +DIR_ARCH:=$(ARCH) + +define Build/Prepare + mkdir $(PKG_BUILD_DIR)/$(PKG_NAME) + cp -r ./files/$(DIR_ARCH)/* $(PKG_BUILD_DIR)/$(PKG_NAME)/lingti +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME)/lingti $(1)/usr/bin + + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./root/etc/init.d/lingti $(1)/etc/init.d +endef + +define Package/$(PKG_NAME)/postinst +#!/bin/sh +chmod +x $(1)/usr/bin/lingti +chmod +x $(1)/etc/init.d/lingti +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/LingTiGameAcc/README.md b/LingTiGameAcc/README.md new file mode 100644 index 000000000..b577c57f9 --- /dev/null +++ b/LingTiGameAcc/README.md @@ -0,0 +1,3 @@ +# LingTiGameAcc + +This Tools can be functioning `independently` without luci app. diff --git a/LingTiGameAcc/files/aarch64/lingti b/LingTiGameAcc/files/aarch64/lingti new file mode 100755 index 000000000..ccadfb68f Binary files /dev/null and b/LingTiGameAcc/files/aarch64/lingti differ diff --git a/LingTiGameAcc/files/arm/lingti b/LingTiGameAcc/files/arm/lingti new file mode 100755 index 000000000..10abe8fb5 Binary files /dev/null and b/LingTiGameAcc/files/arm/lingti differ diff --git a/LingTiGameAcc/files/mips/lingti b/LingTiGameAcc/files/mips/lingti new file mode 100755 index 000000000..288cdd4b5 Binary files /dev/null and b/LingTiGameAcc/files/mips/lingti differ diff --git a/LingTiGameAcc/files/mipsel/lingti b/LingTiGameAcc/files/mipsel/lingti new file mode 100755 index 000000000..7bf36680c Binary files /dev/null and b/LingTiGameAcc/files/mipsel/lingti differ diff --git a/LingTiGameAcc/files/x86_64/lingti b/LingTiGameAcc/files/x86_64/lingti new file mode 100755 index 000000000..23a5f90bc Binary files /dev/null and b/LingTiGameAcc/files/x86_64/lingti differ diff --git a/LingTiGameAcc/root/etc/init.d/lingti b/LingTiGameAcc/root/etc/init.d/lingti new file mode 100755 index 000000000..d0461fa71 --- /dev/null +++ b/LingTiGameAcc/root/etc/init.d/lingti @@ -0,0 +1,28 @@ +#!/bin/sh /etc/rc.common + +START=99 + +[ -d /var/bin ] || mkdir -p /var/bin +[ -f /var/bin/lingti ] || cp /usr/bin/lingti /var/bin/lingti + +start() { + state=`pgrep -f "/var/bin/lingti"` + if [ ! -z "$state" ]; then + restart + else + /var/bin/lingti & + fi + echo "LingTiGameAcc Started..." +} + +stop() { + kill -9 `pgrep -f "/var/bin/lingti"` 2>/dev/null + echo "LingTiGameAcc Stopped ..." +} + +restart() { + stop + sleep 1 + start + echo "Restarted." +} \ No newline at end of file diff --git a/luci-app-LingTiGameAcc/LICENSE b/luci-app-LingTiGameAcc/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/luci-app-LingTiGameAcc/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/luci-app-LingTiGameAcc/Makefile b/luci-app-LingTiGameAcc/Makefile new file mode 100644 index 000000000..2889fd399 --- /dev/null +++ b/luci-app-LingTiGameAcc/Makefile @@ -0,0 +1,67 @@ +# +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-LingTiGameAcc +PKG_VERSION:=20200726 +PKG_RELEASE:=1 +PKG_MAINTAINER:=eSir Playground + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + CATEGORY:=eSir Playground + SUBMENU:=2. GameAcc + TITLE:=LuCI support for LingTiGameAcc + PKGARCH:=all + DEPENDS:=+LingTiGameAcc +endef + +define Package/$(PKG_NAME)/description +LuCI Support of Simple Switch to turn LingTiGameAcc ON/OFF +endef + +define Build/Prepare +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./root/etc/config/lingti $(1)/etc/config/lingti + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./root/etc/init.d/lingti_luci $(1)/etc/init.d/lingti_luci + + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_CONF) ./root/etc/uci-defaults/* $(1)/etc/uci-defaults + + $(INSTALL_DIR) $(1)/usr/lib/lua/luci + cp -pR ./luasrc/* $(1)/usr/lib/lua/luci/ + + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n + po2lmo ./po/zh-cn/lingti.po $(1)/usr/lib/lua/luci/i18n/lingti.zh-cn.lmo +endef + +define Package/$(PKG_NAME)/postinst +#!/bin/sh + /etc/init.d/lingti_luci enable >/dev/null 2>&1 + chmod a+x $${IPKG_INSTROOT}/etc/init.d/lingti_luci >/dev/null 2>&1 +exit 0 +endef + +define Package/$(PKG_NAME)/prerm +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + /etc/init.d/lingti_luci disable + /etc/init.d/lingti_luci stop +fi +exit 0 +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/luci-app-LingTiGameAcc/README.md b/luci-app-LingTiGameAcc/README.md new file mode 100644 index 000000000..37ee6b4c0 --- /dev/null +++ b/luci-app-LingTiGameAcc/README.md @@ -0,0 +1,2 @@ +# luci-app-LingTiGameAcc +Luci support of LingTi Game Accelerator diff --git a/luci-app-LingTiGameAcc/luasrc/controller/lingti.lua b/luci-app-LingTiGameAcc/luasrc/controller/lingti.lua new file mode 100644 index 000000000..60d49fd71 --- /dev/null +++ b/luci-app-LingTiGameAcc/luasrc/controller/lingti.lua @@ -0,0 +1,15 @@ +module("luci.controller.lingti",package.seeall) + +function index() + if not nixio.fs.access("/etc/config/lingti") then return end + + entry({"admin", "services", "lingti"}, cbi("lingti/lingti"), ("LingTi GameAcc"),99).dependent=true + entry({"admin","services","lingti","status"},call("act_status")).leaf=true +end + +function act_status() + local e={} + e.running=luci.sys.call("pgrep -f lingti >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end \ No newline at end of file diff --git a/luci-app-LingTiGameAcc/luasrc/model/cbi/lingti/lingti.lua b/luci-app-LingTiGameAcc/luasrc/model/cbi/lingti/lingti.lua new file mode 100644 index 000000000..13345b2bd --- /dev/null +++ b/luci-app-LingTiGameAcc/luasrc/model/cbi/lingti/lingti.lua @@ -0,0 +1,20 @@ +require("luci.util") + +mp = Map("lingti", translate("LingTi Game Accelerator")) +mp.description = translate("A Paid Game Acceleration service, Please use with Mobile App") +mp:section(SimpleSection).template = "lingti/lingti_status" + +s = mp:section(TypedSection, "lingti") +s.anonymous=true +s.addremove=false + +o = s:option(Flag, "enabled", translate("Enable")) +o.default = 0 +o.optional = false + +local apply = luci.http.formvalue("cbi.apply") +if apply then + io.popen("/etc/init.d/lingti_luci start &") +end + +return mp diff --git a/luci-app-LingTiGameAcc/luasrc/view/lingti/lingti_status.htm b/luci-app-LingTiGameAcc/luasrc/view/lingti/lingti_status.htm new file mode 100644 index 000000000..1fa7bb38e --- /dev/null +++ b/luci-app-LingTiGameAcc/luasrc/view/lingti/lingti_status.htm @@ -0,0 +1,21 @@ + + +
+

+ <%:Collecting data...%> +

+
\ No newline at end of file diff --git a/luci-app-LingTiGameAcc/po/zh-cn/lingti.po b/luci-app-LingTiGameAcc/po/zh-cn/lingti.po new file mode 100644 index 000000000..7b6113568 --- /dev/null +++ b/luci-app-LingTiGameAcc/po/zh-cn/lingti.po @@ -0,0 +1,12 @@ + +msgid "Enable" +msgstr "启用" + +msgid "LingTi GameAcc" +msgstr "灵缇游戏加速器" + +msgid "LingTi Game Accelerator" +msgstr "灵缇游戏加速器" + +msgid "A Paid Game Acceleration service, Please use with Mobile App" +msgstr "一个需要付费的游戏加速器(开启服务后,配合官方手机APP绑定路由器使用)" diff --git a/luci-app-LingTiGameAcc/po/zh_Hans b/luci-app-LingTiGameAcc/po/zh_Hans new file mode 120000 index 000000000..41451e4a1 --- /dev/null +++ b/luci-app-LingTiGameAcc/po/zh_Hans @@ -0,0 +1 @@ +zh-cn \ No newline at end of file diff --git a/luci-app-LingTiGameAcc/root/etc/config/lingti b/luci-app-LingTiGameAcc/root/etc/config/lingti new file mode 100644 index 000000000..8ec581057 --- /dev/null +++ b/luci-app-LingTiGameAcc/root/etc/config/lingti @@ -0,0 +1,4 @@ + +config lingti 'lingti' + option enabled '0' + diff --git a/luci-app-LingTiGameAcc/root/etc/init.d/lingti_luci b/luci-app-LingTiGameAcc/root/etc/init.d/lingti_luci new file mode 100644 index 000000000..7a55a586d --- /dev/null +++ b/luci-app-LingTiGameAcc/root/etc/init.d/lingti_luci @@ -0,0 +1,28 @@ +#!/bin/sh /etc/rc.common + +[ -d /var/bin ] || mkdir -p /var/bin +[ -f /var/bin/lingti ] || cp /usr/bin/lingti /var/bin/lingti + + +START=90 +STOP=15 + +start() { + config_load lingti + local enable + config_get_bool enable lingti enabled + if [ "$enable" -eq 0 ]; then + stop + else + /etc/init.d/lingti enable + /var/bin/lingti & 2>/dev/null + fi +} + +stop() { + config_load lingti + local enabled + config_get_bool enabled lingti enabled + /etc/init.d/lingti disable + kill -9 `pgrep -f "/var/bin/lingti"` 2>/dev/null +} diff --git a/luci-app-LingTiGameAcc/root/etc/uci-defaults/45_luci-lingti b/luci-app-LingTiGameAcc/root/etc/uci-defaults/45_luci-lingti new file mode 100644 index 000000000..9540324d3 --- /dev/null +++ b/luci-app-LingTiGameAcc/root/etc/uci-defaults/45_luci-lingti @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@lingti[-1] + add ucitrack lingti + set ucitrack.@lingti[-1].init=lingti_luci + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/luci-app-LingTiGameAcc/root/usr/share/rpcd/acl.d/luci-app-LingTiGameAcc.json b/luci-app-LingTiGameAcc/root/usr/share/rpcd/acl.d/luci-app-LingTiGameAcc.json new file mode 100644 index 000000000..00d1eb0f2 --- /dev/null +++ b/luci-app-LingTiGameAcc/root/usr/share/rpcd/acl.d/luci-app-LingTiGameAcc.json @@ -0,0 +1,11 @@ +{ + "luci-app-LingTiGameAcc": { + "description": "Grant UCI access for luci-app-LingTiGameAcc", + "read": { + "uci": [ "lingti" ] + }, + "write": { + "uci": [ "lingti" ] + } + } +} diff --git a/luci-app-v2raya/Makefile b/luci-app-v2raya/Makefile new file mode 100644 index 000000000..9d43268c8 --- /dev/null +++ b/luci-app-v2raya/Makefile @@ -0,0 +1,15 @@ +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for v2rayA +LUCI_DEPENDS:=+v2raya +lua +libuci-lua +LUCI_PKGARCH:=all + +PKG_NAME:=luci-app-v2raya +PKG_VERSION:=1.0 +PKG_RELEASE:=2 + +PKG_MAINTAINER:=zxlhhyccc + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-v2raya/README.md b/luci-app-v2raya/README.md new file mode 100644 index 000000000..2a473f7ac --- /dev/null +++ b/luci-app-v2raya/README.md @@ -0,0 +1 @@ +# 简易的 v2rayA 开关 \ No newline at end of file diff --git a/luci-app-v2raya/luasrc/controller/v2raya.lua b/luci-app-v2raya/luasrc/controller/v2raya.lua new file mode 100644 index 000000000..df52c14f3 --- /dev/null +++ b/luci-app-v2raya/luasrc/controller/v2raya.lua @@ -0,0 +1,21 @@ +module("luci.controller.v2raya", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/v2raya") then + return + end + + local page = entry({"admin", "services", "v2raya"}, cbi("v2raya"), _("v2rayA"), 30) + page.dependent = true + page.acl_depends = { "luci-app-v2raya" } + + entry({"admin", "services", "v2raya", "status"}, call("act_status")).leaf = true +end + +function act_status() + local e = {} + e.running = luci.sys.call("pgrep -f v2raya >/dev/null") == 0 + e.bin_version = luci.sys.exec("v2raya --version") + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end diff --git a/luci-app-v2raya/luasrc/model/cbi/v2raya.lua b/luci-app-v2raya/luasrc/model/cbi/v2raya.lua new file mode 100644 index 000000000..1cde88c9c --- /dev/null +++ b/luci-app-v2raya/luasrc/model/cbi/v2raya.lua @@ -0,0 +1,109 @@ +-- Copyright 2008 Yanira +-- Licensed to the public under the Apache License 2.0. + +local uci = luci.model.uci.cursor() +local m, o, s +require("nixio.fs") + +m = Map("v2raya") +m.title = translate("v2rayA") +m.description = translate("v2rayA is a V2Ray Linux client supporting global transparent proxy, compatible with SS, SSR, Trojan(trojan-go), PingTunnel protocols.") + +m:section(SimpleSection).template = "v2raya/v2raya_status" + +s = m:section(TypedSection, "v2raya") +s.anonymous = true +s.addremove = false + +o = s:option(Flag, "enabled", translate("Enabled")) +o.default = 0 +o.rmempty = false + +o = s:option(Value, "address", translate("GUI access address")) +o.description = translate("Use 0.0.0.0:2017 to monitor all access.") +o.default = "http://0.0.0.0:2017" +o.rmempty = false + +o = s:option(Value, "config", translate("v2rayA configuration directory")) +o.rmempty = '/etc/v2raya' + +o = s:option(ListValue, "ipv6_support", translate("Ipv6 Support")) +o.description = translate("Make sure your IPv6 network works fine before you turn it on.") +o:value("auto", translate("AUTO")) +o:value("on", translate("ON")) +o:value("off", translate("OFF")) +o.default = auto + +o = s:option(Value, "log_file", translate("Log file")) +o.default = "/tmp/v2raya.log" + +o = s:option(ListValue, "log_level", translate("Log Level")) +o:value("trace",translate("Trace")) +o:value("debug",translate("Debug")) +o:value("info",translate("Info")) +o:value("warn",translate("Warning")) +o:value("error",translate("Error")) +o.default = "Info" + +o = s:option(ListValue, "log_max_days", translate("Log Keepd Max Days")) +o.description = translate("Maximum number of days to keep log files is 3 day.") +o.datatype = "uinteger" +o:value("1", translate("1")) +o:value("2", translate("2")) +o:value("3", translate("3")) +o.default = 3 +o.rmempty = false +o.optional = false + +o = s:option(Flag, "log_disable_color", translate("Disable log color")) +o.default = '1' +o.rmempty = false +o.optional = false + +o = s:option(Flag, "log_disable_timestamp", translate("Log disable timestamp")) +o.default = '0' +o.rmempty = false +o.optional = false + +o = s:option(Value, "vless_grpc_inbound_cert_key", translate("Upload certificate")) +o.description = translate("Specify the certification path instead of automatically generating a self-signed certificate.") +o.template = "v2raya/v2raya_certupload" + +cert_dir = "/etc/v2raya/" +local path + +luci.http.setfilehandler(function(meta, chunk, eof) + if not fd then + if (not meta) or (not meta.name) or (not meta.file) then + return + end + fd = nixio.open(cert_dir .. meta.file, "w") + if not fd then + path = translate("Create upload file error.") + return + end + end + if chunk and fd then + fd:write(chunk) + end + if eof and fd then + fd:close() + fd = nil + path = '/etc/v2raya/' .. meta.file .. '' + end +end) +if luci.http.formvalue("upload") then + local f = luci.http.formvalue("ulfile") + if #f <= 0 then + path = translate("No specify upload file.") + end +end + +o = s:option(Value, "vless_grpc_inbound_cert_key", translate("Upload Certificate Path")) +o.description = translate("This is the path where the certificate resides after the certificate is uploaded.") +o.default = "/etc/v2raya/cert.crt,/etc/v2raya/cert.key" + +o.inputstyle = "reload" + luci.sys.exec("/etc/init.d/v2raya start >/dev/null 2>&1 &") + +return m diff --git a/luci-app-v2raya/luasrc/view/v2raya/v2raya_certupload.htm b/luci-app-v2raya/luasrc/view/v2raya/v2raya_certupload.htm new file mode 100644 index 000000000..766e420bd --- /dev/null +++ b/luci-app-v2raya/luasrc/view/v2raya/v2raya_certupload.htm @@ -0,0 +1,4 @@ +<%+cbi/valueheader%> + + +<%+cbi/valuefooter%> diff --git a/luci-app-v2raya/luasrc/view/v2raya/v2raya_status.htm b/luci-app-v2raya/luasrc/view/v2raya/v2raya_status.htm new file mode 100644 index 000000000..b9c341836 --- /dev/null +++ b/luci-app-v2raya/luasrc/view/v2raya/v2raya_status.htm @@ -0,0 +1,28 @@ + + +
+

+ <%:Collecting data...%> +

+
diff --git a/luci-app-v2raya/po/zh-cn/v2raya.po b/luci-app-v2raya/po/zh-cn/v2raya.po new file mode 100644 index 000000000..9b2a1dfda --- /dev/null +++ b/luci-app-v2raya/po/zh-cn/v2raya.po @@ -0,0 +1,90 @@ +msgid "v2rayA" +msgstr "v2rayA" + +msgid "v2rayA is a V2Ray Linux client supporting global transparent proxy, compatible with SS, SSR, Trojan(trojan-go), PingTunnel protocols." +msgstr "v2rayA 是一个支持全局透明代理的 V2Ray Linux 客户端,同时兼容 SS、SSR、Trojan(trojan-go)、PingTunnel 协议" + +msgid "Service is not running." +msgstr "服务未运行" + +msgid "Service is running." +msgstr "服务正在运行" + +msgid "Open v2rayA page" +msgstr "打开 v2rayA 页面" + +msgid "GUI access address" +msgstr "GUI访问地址" + +msgid "Use 0.0.0.0:2017 to monitor all access." +msgstr "使用 0.0.0.0:2017 监听所有访问。" + +msgid "v2rayA configuration directory" +msgstr "v2rayA 配置目录" + +msgid "Ipv6 Support" +msgstr "IPv6 支持" + +msgid "Make sure your IPv6 network works fine before you turn it on." +msgstr "在开启之前确保您的 IPv6 网络工作正常。" + +msgid "AUTO" +msgstr "自动" + +msgid "ON" +msgstr "开启" + +msgid "OFF" +msgstr "关闭" + +msgid "Log file" +msgstr "日志文件" + +msgid "Log level" +msgstr "日志等级" + +msgid "Trace" +msgstr "追踪" + +msgid "Debug" +msgstr "调试" + +msgid "Info" +msgstr "信息" + +msgid "Warning" +msgstr "警告" + +msgid "Error" +msgstr "错误" + +msgid "Log Keepd Max Days" +msgstr "日志记录天数" + +msgid "Maximum number of days to keep log files is 3 day." +msgstr "保留日志文件的最大天数为 3 天。" + +msgid "Disable log color" +msgstr "禁用日志颜色" + +msgid "Log disable timestamp" +msgstr "禁用日志时间戳" + +msgid "Upload certificate" +msgstr "上传证书" + +msgid "Upload" +msgstr "上传" + +msgid "Specify the certification path instead of automatically generating a self-signed certificate." +msgstr "指定证书路径而不是自动生成自签名证书。" + +msgid "No specify upload file." +msgstr "没有上传证书" + +msgid "Upload Certificate Path" +msgstr "上传的证书路径" + +msgid "This is the path where the certificate resides after the certificate is uploaded." +msgstr "这里是上传证书后证书所在的路径。" + diff --git a/luci-app-v2raya/po/zh_Hans b/luci-app-v2raya/po/zh_Hans new file mode 120000 index 000000000..41451e4a1 --- /dev/null +++ b/luci-app-v2raya/po/zh_Hans @@ -0,0 +1 @@ +zh-cn \ No newline at end of file diff --git a/luci-app-v2raya/root/etc/uci-defaults/luci-v2raya b/luci-app-v2raya/root/etc/uci-defaults/luci-v2raya new file mode 100755 index 000000000..c255d91c3 --- /dev/null +++ b/luci-app-v2raya/root/etc/uci-defaults/luci-v2raya @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@v2raya[-1] + add ucitrack v2raya + set ucitrack.@v2raya[-1].init=v2raya + commit ucitrack +EOF + +rm -rf /tmp/luci-indexcache /tmp/luci-modulecache +exit 0 diff --git a/luci-app-v2raya/root/usr/share/rpcd/acl.d/luci-app-v2raya.json b/luci-app-v2raya/root/usr/share/rpcd/acl.d/luci-app-v2raya.json new file mode 100644 index 000000000..81f9ea5dc --- /dev/null +++ b/luci-app-v2raya/root/usr/share/rpcd/acl.d/luci-app-v2raya.json @@ -0,0 +1,11 @@ +{ + "luci-app-v2raya": { + "description": "Grant UCI access for luci-app-v2raya", + "read": { + "uci": [ "v2raya" ] + }, + "write": { + "uci": [ "v2raya" ] + } + } +} diff --git a/v2raya/Makefile b/v2raya/Makefile new file mode 100644 index 000000000..a57ec47b1 --- /dev/null +++ b/v2raya/Makefile @@ -0,0 +1,105 @@ +# SPDX-License-Identifier: GPL-3.0-only +# +# Copyright (C) 2021 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=v2rayA +PKG_VERSION:=1.5.6.2 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/v2rayA/v2rayA/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=skip +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/service + +PKG_LICENSE:=AGPL-3.0-only +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Tianling Shen + +PKG_CONFIG_DEPENDS:= \ + CONFIG_V2RAYA_COMPRESS_GOPROXY \ + CONFIG_V2RAYA_COMPRESS_UPX \ + +PKG_BUILD_DEPENDS:=golang/host node/host node-yarn/host +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +GO_PKG:=github.com/v2rayA/v2rayA +GO_PKG_LDFLAGS:=-s -w +GO_PKG_LDFLAGS_X:=$(GO_PKG)/conf.Version=$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk + +TAR_OPTIONS+= --strip-components 1 +TAR_CMD=$(HOST_TAR) -C $(1)/.. $(TAR_OPTIONS) + +define Package/v2raya + TITLE:=A Linux web GUI client of Project V + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + DEPENDS:=$(GO_ARCH_DEPENDS) \ + +ca-bundle \ + +iptables-mod-conntrack-extra \ + +iptables-mod-extra \ + +iptables-mod-filter \ + +iptables-mod-tproxy \ + +kmod-ipt-nat6 \ + +xray-core + URL:=https://v2raya.org +endef + +define Package/v2raya/description + v2rayA is a V2Ray Linux client supporting global transparent proxy, + compatible with SS, SSR, Trojan(trojan-go), PingTunnel protocols. +endef + +define Package/v2raya/config +config V2RAYA_COMPRESS_GOPROXY + bool "Compiling with GOPROXY proxy" + default n + +config V2RAYA_COMPRESS_UPX + bool "Compress executable files with UPX" + depends on !mips64 + default n +endef + +ifneq ($(CONFIG_V2RAYA_COMPRESS_GOPROXY),) + export GO111MODULE=on + export GOPROXY=https://goproxy.bj.bcebos.com +endif + +define Package/v2raya/conffiles +/etc/v2raya/ +/etc/config/v2raya +endef + +define Build/Compile + ( \ + pushd $(PKG_BUILD_DIR)/../gui ; \ + yarn ; \ + OUTPUT_DIR=../service/server/router/web yarn build ; \ + popd ; \ + $(call GoPackage/Build/Compile) ; \ + ) +ifneq ($(CONFIG_V2RAYA_COMPRESS_UPX),) + $(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/v2rayA +endif +endef + +define Package/v2raya/install + $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR)) + $(INSTALL_DIR) $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/v2rayA $(1)/usr/bin/v2raya + + $(INSTALL_DIR) $(1)/etc/config/ + $(INSTALL_CONF) $(CURDIR)/files/v2raya.config $(1)/etc/config/v2raya + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) $(CURDIR)/files/v2raya.init $(1)/etc/init.d/v2raya +endef + +$(eval $(call GoBinPackage,v2raya)) +$(eval $(call BuildPackage,v2raya)) diff --git a/v2raya/files/v2raya.config b/v2raya/files/v2raya.config new file mode 100644 index 000000000..841b90a2a --- /dev/null +++ b/v2raya/files/v2raya.config @@ -0,0 +1,37 @@ + +config v2raya 'config' + option enabled '0' + + # Listening address + option address '0.0.0.0:2017' + + # v2rayA configuration directory + option config '/etc/v2raya' + + # Make sure your IPv6 network works fine before you turn it on. + # Optional values: auto, on, off. + option ipv6_support 'auto' + + # Optional values: trace, debug, info, warn or error + option log_level 'info' + + # The path of log file + option log_file '/tmp/v2raya.log' + + # Maximum number of days to keep log files + option log_max_days '3' + + option log_disable_color '1' + + option log_disable_timestamp '0' + + # Executable v2ray binary path. Auto-detect if put it empty + option v2ray_bin '' + + # Additional v2ray config directory, files in it will be combined with config generated by v2rayA + option v2ray_confdir '' + + # Specify the certification path instead of automatically generating a self-signed certificate. + # Example: /etc/v2raya/grpc_certificate.crt,/etc/v2raya/grpc_private.key + option vless_grpc_inbound_cert_key '' + diff --git a/v2raya/files/v2raya.init b/v2raya/files/v2raya.init new file mode 100755 index 000000000..826935d5c --- /dev/null +++ b/v2raya/files/v2raya.init @@ -0,0 +1,70 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2021 Tianling Shen + +USE_PROCD=1 +START=99 + +CONF="v2raya" +PROG="/usr/bin/v2raya" + +is_enabled() { + local enabled + config_get_bool enabled "$1" "$2" "${3:-0}" + if [ "$enabled" -eq "1" ]; then + return 0 + else + return 1 + fi +} + +append_env() { + procd_append_param env "V2RAYA_$(echo "$1" | tr "[a-z]" "[A-Z]")"="$2" +} + +append_env_arg() { + local value + config_get value "$1" "$2" $3 + [ -n "$value" ] && append_env "$2" "$value" +} + +append_env_bool() { + is_enabled "$1" "$2" && append_env "$2" "true" +} + +start_service() { + config_load "$CONF" + + is_enabled "config" "enabled" || exit 1 + + procd_open_instance "$CONF" + procd_set_param command "$PROG" + procd_set_param env XDG_DATA_HOME="/usr/share" + + append_env_arg "config" "address" "0.0.0.0:2017" + append_env_arg "config" "config" "/etc/v2raya" + append_env_arg "config" "ipv6_support" "auto" + append_env_arg "config" "log_level" "info" + append_env_arg "config" "log_file" "/tmp/v2raya.log" + append_env_arg "config" "log_max_days" "3" + append_env_arg "config" "v2ray_bin" + append_env_arg "config" "v2ray_confdir" + append_env_arg "config" "vless_grpc_inbound_cert_key" + append_env_bool "config" "log_disable_color" + append_env_bool "config" "log_disable_timestamp" + + procd_set_param limits core="unlimited" + procd_set_param respawn + procd_set_param stdout 1 + procd_set_param stderr 1 + + procd_close_instance +} + +reload_service() { + stop + start +} + +service_triggers() { + procd_add_reload_trigger "$CONF" +} diff --git a/v2raya/test.sh b/v2raya/test.sh new file mode 100644 index 000000000..2c53d5fe1 --- /dev/null +++ b/v2raya/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +v2raya --version | grep "$PKG_VERSION"