pex: add support for figuring out the external data port via STUN servers
[project/unetd.git] / CMakeLists.txt
index 8c0e5e88c5fa161817997c70985273088631554b..ec31711dc7ee108c85eb69f677310e969ddf353d 100644 (file)
@@ -4,7 +4,7 @@ PROJECT(unetd C)
 
 
 SET(SOURCES
-       main.c network.c host.c service.c pex.c
+       main.c network.c host.c service.c pex.c pex-stun.c
        wg.c wg-user.c
 )
 
@@ -36,13 +36,14 @@ ENDIF()
 
 IF(UBUS_SUPPORT)
   SET(SOURCES ${SOURCES} ubus.c)
+  SET(DHT_SOURCES ${DHT_SOURCES} udht-ubus.c)
   ADD_DEFINITIONS(-DUBUS_SUPPORT=1)
   FIND_LIBRARY(ubus ubus)
 ELSE()
   SET(ubus "")
 ENDIF()
 
-ADD_LIBRARY(unet SHARED curve25519.c siphash.c sha512.c fprime.c f25519.c ed25519.c edsign.c auth-data.c chacha20.c pex-msg.c utils.c)
+ADD_LIBRARY(unet SHARED curve25519.c siphash.c sha512.c fprime.c f25519.c ed25519.c edsign.c auth-data.c chacha20.c pex-msg.c utils.c stun.c)
 TARGET_LINK_LIBRARIES(unet ubox)
 
 ADD_EXECUTABLE(unetd ${SOURCES})
@@ -51,7 +52,10 @@ TARGET_LINK_LIBRARIES(unetd unet ubox ${ubus} blobmsg_json ${libjson} ${nl} ${bp
 ADD_EXECUTABLE(unet-tool cli.c)
 TARGET_LINK_LIBRARIES(unet-tool unet blobmsg_json ${libjson} ubox)
 
-INSTALL(TARGETS unetd unet unet-tool
+ADD_EXECUTABLE(unet-dht dht.c udht.c ${DHT_SOURCES})
+TARGET_LINK_LIBRARIES(unet-dht unet ${ubus} ubox)
+
+INSTALL(TARGETS unetd unet unet-tool unet-dht
        RUNTIME DESTINATION sbin
        LIBRARY DESTINATION lib
 )