Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2024-01-10 06:31:42 +03:00
parent 72be4b3b62
commit 29ccc82581

View File

@ -17,13 +17,8 @@ ENDPOINT ?= ${ENDPOINT}
DNS ?= ${DNS} DNS ?= ${DNS}
ALLOWED_IPS ?= 0.0.0.0/0 ALLOWED_IPS ?= 0.0.0.0/0
# XXX need to generate this...
CLIENT_IP ?= 10.42.0.1/32
test:
$(call newIP)
%_id: %_id:
@ mkdir -p $$(dirname $@) @ mkdir -p $$(dirname $@)
@ -54,13 +49,13 @@ $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY)
-e 's/\$${\ENDPOINT}/$(ENDPOINT)/g' \ -e 's/\$${\ENDPOINT}/$(ENDPOINT)/g' \
-e 's/\$${\ENDPOINT_PORT}/$(ENDPOINT_PORT)/g' \ -e 's/\$${\ENDPOINT_PORT}/$(ENDPOINT_PORT)/g' \
-e 's/\$${\ALLOWED_IPS}/$(subst /,\/,$(ALLOWED_IPS))/g' \ -e 's/\$${\ALLOWED_IPS}/$(subst /,\/,$(ALLOWED_IPS))/g' \
-e 's/\$${\CLIENT_IP}/$(shell ./getFreeClientIP)\/$(patsubst %/,,$(CLIENT_IP))/g' \ -e 's/\$${\CLIENT_IP}/$(shell ./getFreeClientIP)\/$(shell echo $(CLIENT_IPS) | sed 's/.*\///')/g' \
-e 's/\$${\CLIENT_PRIVATE_KEY}/'$$(sed -e 's/\//\\\//g' "$(CLIENT_DIR)/$*_id")'/g' \ -e 's/\$${\CLIENT_PRIVATE_KEY}/'$$(sed -e 's/\//\\\//g' "$(CLIENT_DIR)/$*_id")'/g' \
-e 's/\$${\SERVER_PUBLIC_KEY}/'$$(sed -e 's/\//\\\//g' "$(SERVER_PUBLIC_KEY)")'/g' \ -e 's/\$${\SERVER_PUBLIC_KEY}/'$$(sed -e 's/\//\\\//g' "$(SERVER_PUBLIC_KEY)")'/g' \
> "$(CLIENT_DIR)/$*.conf" > "$(CLIENT_DIR)/$*.conf"
cat "$(SERVER_CLIENT_TPL)" \ cat "$(SERVER_CLIENT_TPL)" \
| sed \ | sed \
-e 's/\$${\CLIENT_IP}/$(shell ./getFreeClientIP)\/$(patsubst %/,,$(CLIENT_IP))/g' \ -e 's/\$${\CLIENT_IP}/$(shell ./getFreeClientIP)\/$(shell echo $(CLIENT_IPS) | sed 's/.*\///')/g' \
-e 's/\$${\ENDPOINT}/$(ENDPOINT)/g' \ -e 's/\$${\ENDPOINT}/$(ENDPOINT)/g' \
-e 's/\$${\ENDPOINT_PORT}/$(ENDPOINT_PORT)/g' \ -e 's/\$${\ENDPOINT_PORT}/$(ENDPOINT_PORT)/g' \
-e 's/\$${\CLIENT_PUBLIC_KEY}/'$$(sed -e 's/\//\\\//g' "$(CLIENT_DIR)/$*_id.pub")'/g' \ -e 's/\$${\CLIENT_PUBLIC_KEY}/'$$(sed -e 's/\//\\\//g' "$(CLIENT_DIR)/$*_id.pub")'/g' \