1
0
mirror of https://github.com/kenzok8/small-package synced 2025-09-20 19:11:30 +08:00

update 03-13 19:54

This commit is contained in:
github-actions[bot]
2022-03-13 19:54:57 +08:00
parent 761ff9ea66
commit cd3c165d12
11 changed files with 236 additions and 0 deletions

82
gost/Makefile Normal file
View File

@ -0,0 +1,82 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=gost
PKG_VERSION:=2.11.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/ginuerzh/gost/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=skip
PKG_LICENSE:=MIT
PKG_LICENSE_FILE:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_CONFIG_DEPENDS:= \
CONFIG_GOST_COMPRESS_GOPROXY \
CONFIG_GOST_COMPRESS_UPX
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/ginuerzh/gost
GO_PKG_BUILD_PKG:=github.com/ginuerzh/gost/cmd/gost
GO_PKG_LDFLAGS:=-s -w
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/gost
SECTION:=net
CATEGORY:=Network
TITLE:=GO Simple Tunnel
URL:=https://github.com/ginuerzh/gost
DEPENDS:=$(GO_ARCH_DEPENDS)
endef
define Package/gost/description
A simple security tunnel written in Golang
endef
define Package/gost/config
config GOST_COMPRESS_GOPROXY
bool "Compiling with GOPROXY proxy"
default n
config GOST_COMPRESS_UPX
bool "Compress executable files with UPX"
depends on !mips64
default n
endef
ifeq ($(CONFIG_GOST_COMPRESS_GOPROXY),y)
export GO111MODULE=on
export GOPROXY=https://goproxy.bj.bcebos.com
endif
define Build/Compile
$(call GoPackage/Build/Compile)
ifeq ($(CONFIG_GOST_COMPRESS_UPX),y)
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/gost
endif
endef
define Package/gost/install
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gost $(1)/usr/bin/gost
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(CURDIR)/files/gost.config $(1)/etc/config/gost
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(CURDIR)/files/gost.init $(1)/etc/init.d/gost
endef
$(eval $(call GoBinPackage,gost))
$(eval $(call BuildPackage,gost))

5
gost/files/gost.config Normal file
View File

@ -0,0 +1,5 @@
config gost
option enable '0'
option run_command ''

22
gost/files/gost.init Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh /etc/rc.common
# Created By ImmortalWrt
# https://github.com/project-openwrt
START=90
STOP=10
enable="$(uci get gost.@gost[0].enable)"
run_command="$(uci get gost.@gost[0].run_command)"
start()
{
stop
[ "${enable}" -ne "1" ] && exit 0
/usr/bin/gost ${run_command} &
}
stop()
{
killall -9 "gost" > "/dev/null" 2>&1
}

21
luci-app-gost/Makefile Normal file
View File

@ -0,0 +1,21 @@
# Copyright (C) 2020 Openwrt.org
#
# This is a free software, use it under GNU General Public License v3.0.
#
# Created By ImmortalWrt
# https://github.com/project-openwrt
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-gost
PKG_VERSION:=1.0
PKG_RELEASE:=1
LUCI_TITLE:=LuCI support for Gost
LUCI_DEPENDS:=+gost
LUCI_PKGARCH:=all
PKG_MAINTAINER:=ImmortalWrt
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,24 @@
-- This is a free software, use it under GNU General Public License v3.0.
-- Created By ImmortalWrt
-- https://github.com/immortalwrt
module("luci.controller.gost", package.seeall)
function index()
if not nixio.fs.access("/etc/config/gost") then
return
end
local page
page = entry({"admin", "services", "gost"}, cbi("gost"), _("Gost"), 100)
page.dependent = true
page.acl_depends = { "luci-app-gost" }
entry({"admin", "services", "gost", "status"},call("act_status")).leaf=true
end
function act_status()
local e={}
e.running=luci.sys.call("pgrep gost >/dev/null")==0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -0,0 +1,20 @@
-- Created By ImmortalWrt
-- https://github.com/immortalwrt
mp = Map("gost", translate("Gost"))
mp.description = translate("A simple security tunnel written in Golang.")
mp:section(SimpleSection).template = "gost/gost_status"
s = mp:section(TypedSection, "gost")
s.anonymous=true
s.addremove=false
enable = s:option(Flag, "enable", translate("Enable"))
enable.default = 0
enable.rmempty = false
run_command = s:option(Value, "run_command", translate("Command"))
run_command.rmempty = false
return mp

View File

@ -0,0 +1,22 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[gost]], [[status]])%>', null,
function(x, data) {
var tb = document.getElementById('gost_status');
if (data && tb) {
if (data.running) {
var links = '<em><b><font color=green>Gost <%:RUNNING%></font></b></em>';
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color=red>Gost <%:NOT RUNNING%></font></b></em>';
}
}
}
);
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="gost_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

1
luci-app-gost/po/zh-cn Symbolic link
View File

@ -0,0 +1 @@
zh_Hans

View File

@ -0,0 +1,17 @@
msgid "Gost"
msgstr "Gost"
msgid "A simple security tunnel written in Golang."
msgstr "GO语言实现的安全隧道。"
msgid "RUNNING"
msgstr "运行中"
msgid "NOT RUNNING"
msgstr "未运行"
msgid "Enable"
msgstr "启用"
msgid "Command"
msgstr "命令"

View File

@ -0,0 +1,11 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@gost[-1]
add ucitrack gost
set ucitrack.@gost[-1].init=gost
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,11 @@
{
"luci-app-gost": {
"description": "Grant UCI access for luci-app-gost",
"read": {
"uci": [ "gost" ]
},
"write": {
"uci": [ "gost" ]
}
}
}