mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add glorytun packages and LuCI app
This commit is contained in:
parent
fc579c849e
commit
1b9ebf5ac2
15 changed files with 727 additions and 0 deletions
44
glorytun/Makefile
Normal file
44
glorytun/Makefile
Normal file
|
@ -0,0 +1,44 @@
|
|||
#
|
||||
# Copyright (C) 2015 OVH
|
||||
# Copyright (C) 2017 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=glorytun
|
||||
PKG_VERSION:=0.0.35
|
||||
PKG_RELEASE:=5
|
||||
PKG_SOURCE:=glorytun-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/angt/glorytun/releases/download/v$(PKG_VERSION)
|
||||
PKG_HASH:=49e4d8ea4ff2990300b37947b0bd0da3c8e0985bc6eddf29f4146306188fff64
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+kmod-tun +libsodium +librt
|
||||
TITLE:=Glorytun
|
||||
URL:=https://github.com/angt/glorytun
|
||||
SUBMENU:=VPN
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -std=c99 -D_GNU_SOURCE
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/glorytun
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/glorytun $(1)/usr/sbin/$(PKG_NAME)
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) init $(1)/etc/init.d/$(PKG_NAME)
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) glorytun.config $(1)/etc/config/glorytun
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
8
glorytun/glorytun.config
Normal file
8
glorytun/glorytun.config
Normal file
|
@ -0,0 +1,8 @@
|
|||
config glorytun 'vpn'
|
||||
option enable '0'
|
||||
option host '127.0.0.1'
|
||||
option port '65001'
|
||||
option dev 'tun0'
|
||||
option key 'secretkey'
|
||||
option mptcp '1'
|
||||
option proto 'tcp'
|
81
glorytun/init
Executable file
81
glorytun/init
Executable file
|
@ -0,0 +1,81 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
||||
# Copyright (C) 2015 ovh.com
|
||||
# Copyright (C) 2017 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
|
||||
START=90
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG_NAME=glorytun
|
||||
PROG=/usr/sbin/${PROG_NAME}
|
||||
|
||||
_log() {
|
||||
logger -p daemon.info -t ${PROG_NAME} "$@"
|
||||
}
|
||||
|
||||
_err() {
|
||||
logger -p daemon.err -t ${PROG_NAME} "$@"
|
||||
}
|
||||
|
||||
validate_section() {
|
||||
uci_validate_section glorytun glorytun "${1}" \
|
||||
'enable:bool:0' \
|
||||
'mptcp:bool:0' \
|
||||
'listener:bool:0' \
|
||||
'key:string' \
|
||||
'host:host' \
|
||||
'port:port' \
|
||||
'dev:string' \
|
||||
'proto:string'
|
||||
}
|
||||
|
||||
start_instance() {
|
||||
local enable key host port dev listener mptcp proto
|
||||
|
||||
validate_section "${1}" || {
|
||||
_err "validation failed"
|
||||
return 1
|
||||
}
|
||||
|
||||
[ "${enable}" = "1" ] || return 1
|
||||
[ "${proto}" = "tcp" ] || return 1
|
||||
[ -n "${key}" ] || return 1
|
||||
[ -n "${port}" ] || return 1
|
||||
[ -n "${dev}" ] || return 1
|
||||
|
||||
echo "${key}" > /tmp/${PROG_NAME}-${1}.key
|
||||
key=""
|
||||
|
||||
_log "starting ${PROG_NAME} ${1} instance $*"
|
||||
|
||||
procd_open_instance
|
||||
|
||||
procd_set_param command ${PROG} \
|
||||
keyfile /tmp/${PROG_NAME}-${1}.key \
|
||||
${port:+port "$port"} \
|
||||
${host:+host "$host"} \
|
||||
${listener:+listener}
|
||||
${mptcp:+mptcp} \
|
||||
${dev:+dev "$dev"} \
|
||||
retry count -1 const 5000000 \
|
||||
timeout 5000 \
|
||||
keepalive count 3 idle 10 interval 1
|
||||
|
||||
procd_set_param respawn 0 30 0
|
||||
procd_set_param file /tmp/${PROG_NAME}-${1}.key
|
||||
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load glorytun
|
||||
config_foreach start_instance glorytun
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger glorytun network
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue