rtty: Add package
A reverse proxy WebTTY. It is composed of the client and the server. Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
This commit is contained in:
parent
4d5c752f45
commit
8a7797d67a
|
@ -0,0 +1,82 @@
|
|||
#
|
||||
# Copyright (C) 2018 Jianhui Zhao
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libuwsc
|
||||
PKG_VERSION:=1.1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
|
||||
PKG_SOURCE_URL=https://github.com/zhaojh329/libuwsc.git
|
||||
PKG_MIRROR_HASH:=4aada7e2941fb9f099869c9dc10ef6411f1c355c3b2f570011b91e42feffbfdd
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
|
||||
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_MAINTAINER:=Jianhui Zhao <jianhuizhao329@gmail.com>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/libuwsc/default
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
SUBMENU:=Networking
|
||||
TITLE:=Lightweight WebSocket client library
|
||||
DEPENDS:=+libubox
|
||||
endef
|
||||
|
||||
define Package/libuwsc-nossl
|
||||
$(Package/libuwsc/default)
|
||||
TITLE += (NO SSL)
|
||||
VARIANT:=nossl
|
||||
endef
|
||||
|
||||
define Package/libuwsc-openssl
|
||||
$(Package/libuwsc/default)
|
||||
TITLE += (openssl)
|
||||
DEPENDS += +libustream-openssl
|
||||
VARIANT:=openssl
|
||||
endef
|
||||
|
||||
define Package/libuwsc-wolfssl
|
||||
$(Package/libuwsc/default)
|
||||
TITLE += (wolfssl)
|
||||
DEPENDS += +libustream-wolfssl
|
||||
VARIANT:=wolfssl
|
||||
endef
|
||||
|
||||
define Package/libuwsc-mbedtls
|
||||
$(Package/libuwsc/default)
|
||||
TITLE += (mbedtls)
|
||||
DEPENDS += +libustream-mbedtls
|
||||
VARIANT:=mbedtls
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),nossl)
|
||||
CMAKE_OPTIONS += -DUWSC_SSL_SUPPORT=off
|
||||
endif
|
||||
|
||||
define Package/libuwsc/default/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libuwsc.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
Package/libuwsc-nossl/install = $(Package/libuwsc/default/install)
|
||||
Package/libuwsc-openssl/install = $(Package/libuwsc/default/install)
|
||||
Package/libuwsc-wolfssl/install = $(Package/libuwsc/default/install)
|
||||
Package/libuwsc-mbedtls/install = $(Package/libuwsc/default/install)
|
||||
|
||||
$(eval $(call BuildPackage,libuwsc-nossl))
|
||||
$(eval $(call BuildPackage,libuwsc-mbedtls))
|
||||
$(eval $(call BuildPackage,libuwsc-wolfssl))
|
||||
$(eval $(call BuildPackage,libuwsc-openssl))
|
|
@ -0,0 +1,93 @@
|
|||
#
|
||||
# Copyright (C) 2018 Jianhui Zhao
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rtty
|
||||
PKG_VERSION:=2.2.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
|
||||
PKG_SOURCE_URL=https://github.com/zhaojh329/rtty.git
|
||||
PKG_MIRROR_HASH:=23a203351fdd47acfd16d3c3b3e3d51dd65a5d9e8ca89d4b1521d40c40616102
|
||||
|
||||
PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
|
||||
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_MAINTAINER:=Jianhui Zhao <jianhuizhao329@gmail.com>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/rtty/default
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Terminal
|
||||
TITLE:=A reverse proxy WebTTY
|
||||
DEPENDS:=+libblobmsg-json
|
||||
endef
|
||||
|
||||
define Package/rtty/default/description
|
||||
A reverse proxy WebTTY. This is the client part running on devices to be managed.
|
||||
endef
|
||||
|
||||
define Package/rtty-nossl
|
||||
$(Package/rtty/default)
|
||||
TITLE += (NO SSL)
|
||||
DEPENDS += +libuwsc-nossl
|
||||
VARIANT:=nossl
|
||||
CONFLICTS:=rtty-openssl rtty-wolfssl rtty-mbedtls
|
||||
endef
|
||||
|
||||
define Package/rtty-openssl
|
||||
$(Package/rtty/default)
|
||||
TITLE += (openssl)
|
||||
DEPENDS += +libuwsc-openssl
|
||||
VARIANT:=openssl
|
||||
CONFLICTS:=rtty-wolfssl rtty-mbedtls
|
||||
endef
|
||||
|
||||
define Package/rtty-wolfssl
|
||||
$(Package/rtty/default)
|
||||
TITLE += (wolfssl)
|
||||
DEPENDS += +libuwsc-wolfssl
|
||||
VARIANT:=wolfssl
|
||||
CONFLICTS:=rtty-mbedtls
|
||||
endef
|
||||
|
||||
define Package/rtty-mbedtls
|
||||
$(Package/rtty/default)
|
||||
TITLE += (mbedtls)
|
||||
DEPENDS += +libuwsc-mbedtls
|
||||
VARIANT:=mbedtls
|
||||
endef
|
||||
|
||||
Package/rtty-nossl/description = $(Package/rtty/default/description)
|
||||
Package/rtty-openssl/description = $(Package/rtty/default/description)
|
||||
Package/rtty-wolfssl/description = $(Package/rtty/default/description)
|
||||
Package/rtty-mbedtls/description = $(Package/rtty/default/description)
|
||||
|
||||
define Package/rtty/default/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/rtty $(1)/usr/sbin
|
||||
$(INSTALL_BIN) ./files/rtty.init $(1)/etc/init.d/rtty
|
||||
$(INSTALL_CONF) ./files/rtty.config $(1)/etc/config/rtty
|
||||
endef
|
||||
|
||||
Package/rtty-nossl/install = $(Package/rtty/default/install)
|
||||
Package/rtty-openssl/install = $(Package/rtty/default/install)
|
||||
Package/rtty-wolfssl/install = $(Package/rtty/default/install)
|
||||
Package/rtty-mbedtls/install = $(Package/rtty/default/install)
|
||||
|
||||
$(eval $(call BuildPackage,rtty-nossl))
|
||||
$(eval $(call BuildPackage,rtty-mbedtls))
|
||||
$(eval $(call BuildPackage,rtty-wolfssl))
|
||||
$(eval $(call BuildPackage,rtty-openssl))
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# You must specify an interface or id,
|
||||
# If the id is not specified, RTTY will uses the MAC address
|
||||
# of the interface you specify as its ID, otherwise the id
|
||||
# you specify is used as its ID
|
||||
|
||||
#config rtty
|
||||
# option interface 'lan'
|
||||
# option id 'My-Device'
|
||||
# option description 'Description of my device'
|
||||
# option host 'your-server-host' # Server host
|
||||
# option port '5912' # Server Port
|
||||
# option ssl 1 # Whether to use ssl
|
|
@ -0,0 +1,58 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
USE_PROCD=1
|
||||
START=99
|
||||
|
||||
BIN=/usr/sbin/rtty
|
||||
|
||||
start_rtty() {
|
||||
local cfg="$1"
|
||||
local interface ifname id description host port ssl
|
||||
|
||||
uci_validate_section rtty rtty "${1}" \
|
||||
'interface:uci("network", "@interface"):lan' \
|
||||
'id:maxlength(63)' \
|
||||
'description:maxlength(126)' \
|
||||
'host:host' \
|
||||
'port:port' \
|
||||
'ssl:bool:0'
|
||||
|
||||
[ $? -eq 1 ] && {
|
||||
echo "validation failed" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -n "$interface" ] && network_get_device ifname "$interface"
|
||||
|
||||
[ -z "$ifname" -a -z "$id" ] && {
|
||||
echo "You must specify an interface or ID" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -z "$host" ] && {
|
||||
echo "host required" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -z "$port" ] && {
|
||||
echo "port required" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command $BIN -h $host -p $port -a
|
||||
[ -n "$ifname" ] && procd_append_param command -i "$ifname"
|
||||
[ -n "$id" ] && procd_append_param command -I "$id"
|
||||
[ -n "$description" ] && procd_append_param command -d "$description"
|
||||
[ "$ssl" = "1" ] && procd_append_param command -s
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load rtty
|
||||
config_foreach start_rtty rtty
|
||||
}
|
||||
|
Loading…
Reference in New Issue