Skip to content

Commit e58a566

Browse files
committed
add DHT discovery service
This uses the BitTorrent 'Mainline' DHT in order to find peers. It operates on the global PEX port, in order to allow exchanging network data through double NAT. Only the IPv4 DHT is used at the moment. Signed-off-by: Felix Fietkau <[email protected]>
1 parent df5f70b commit e58a566

File tree

7 files changed

+3993
-1
lines changed

7 files changed

+3993
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ CMakeFiles
77
*.dylib
88
unetd
99
unet-tool
10+
unet-dht

CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ ENDIF()
3636

3737
IF(UBUS_SUPPORT)
3838
SET(SOURCES ${SOURCES} ubus.c)
39+
SET(DHT_SOURCES ${DHT_SOURCES} udht-ubus.c)
3940
ADD_DEFINITIONS(-DUBUS_SUPPORT=1)
4041
FIND_LIBRARY(ubus ubus)
4142
ELSE()
@@ -51,7 +52,10 @@ TARGET_LINK_LIBRARIES(unetd unet ubox ${ubus} blobmsg_json ${libjson} ${nl} ${bp
5152
ADD_EXECUTABLE(unet-tool cli.c)
5253
TARGET_LINK_LIBRARIES(unet-tool unet blobmsg_json ${libjson} ubox)
5354

54-
INSTALL(TARGETS unetd unet unet-tool
55+
ADD_EXECUTABLE(unet-dht dht.c udht.c ${DHT_SOURCES})
56+
TARGET_LINK_LIBRARIES(unet-dht unet ${ubus} ubox)
57+
58+
INSTALL(TARGETS unetd unet unet-tool unet-dht
5559
RUNTIME DESTINATION sbin
5660
LIBRARY DESTINATION lib
5761
)

0 commit comments

Comments
 (0)