PKG_NAME:=unetd
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/unetd.git
-PKG_SOURCE_DATE:=2022-09-01
-PKG_SOURCE_VERSION:=d7fb9e5b065bf9eecb5bcbcf741b5f89695c5dcc
-PKG_MIRROR_HASH:=a693c2b4b4bda5e1e44b493019e8e6e6d39c4048f417b581c801a9931e6b9b39
+PKG_SOURCE_DATE:=2022-09-16
+PKG_SOURCE_VERSION:=a089e8ae7504e55e05b1a88c3d8d1327460b8d4f
+PKG_MIRROR_HASH:=15ebeb7ccf4fae0ac46df638999d51a8150d3b0859232537b80e6dcb03ffb165
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
endef
+define Package/unet-dht
+ SECTION:=net
+ CATEGORY:=Network
+ DEPENDS:=unetd
+ TITLE:=unetd DHT discovery support
+endef
+
define Package/unet-cli
SECTION:=net
CATEGORY:=Network
$(INSTALL_BIN) ./files/unetd.sh $(1)/lib/netifd/proto
endef
+define Package/unet-dht/install
+ $(INSTALL_DIR) \
+ $(1)/etc/init.d \
+ $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/unet-dht $(1)/usr/sbin
+ $(INSTALL_BIN) ./files/unet-dht.init $(1)/etc/init.d/unet-dht
+endef
+
define Package/unet-cli/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/unet-cli $(1)/usr/sbin
endef
$(eval $(call BuildPackage,unetd))
+$(eval $(call BuildPackage,unet-dht))
$(eval $(call BuildPackage,unet-cli))
mkdir -p /var/run/unetd /etc/unetd
procd_open_instance
- procd_set_param command "$PROG" -h /var/run/unetd/hosts
+ procd_set_param command "$PROG" -h /var/run/unetd/hosts -u /var/run/unetd/socket
procd_set_param respawn
procd_set_param limits core="unlimited"
procd_close_instance
proto_config_add_string file
proto_config_add_int keepalive
proto_config_add_string domain
+ proto_config_add_boolean dht
proto_config_add_array "tunnels:list(string)"
proto_config_add_array "connect:list(string)"
proto_config_add_array "peer_data:list(string)"
local config="$1"
local device type key file keepalive domain tunnels
- json_get_vars device type auth_key key file keepalive domain
+ json_get_vars device type auth_key key file keepalive domain dht
json_get_values tunnels tunnels
json_get_values connect connect
json_get_values peer_data peer_data
json_add_string key "$key"
json_add_string file "$file"
[ -n "$keepalive" ] && json_add_int keepalive "$keepalive"
+ [ -n "$dht" ] && json_add_boolean dht "$dht"
json_add_string domain "$domain"
json_add_object tunnels