librats 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/index.d.ts +2 -1
- package/native-src/CMakeLists.txt +9 -0
- package/native-src/src/dht.cpp +386 -85
- package/native-src/src/dht.h +95 -22
- package/native-src/src/ice.cpp +2 -2
- package/native-src/src/librats.cpp +62 -42
- package/native-src/src/librats.h +5 -2
- package/native-src/src/librats_c.cpp +18 -2
- package/native-src/src/librats_c.h +3 -1
- package/native-src/src/librats_mdns.cpp +5 -0
- package/native-src/src/mdns.cpp +13 -7
- package/native-src/src/mdns.h +2 -0
- package/native-src/src/noise.cpp +3 -1
- package/native-src/src/os.cpp +3 -1
- package/native-src/src/socket.h +3 -1
- package/native-src/src/stun.cpp +2 -2
- package/package.json +1 -1
- package/src/librats_node.cpp +46 -1
package/README.md
CHANGED
|
@@ -205,7 +205,7 @@ client.publishJsonToTopic('general-chat', JSON.stringify(message));
|
|
|
205
205
|
- `startDhtDiscovery(dhtPort: number): boolean` - Start DHT discovery
|
|
206
206
|
- `stopDhtDiscovery(): void` - Stop DHT discovery
|
|
207
207
|
- `isDhtRunning(): boolean` - Check if DHT is running
|
|
208
|
-
- `announceForHash(contentHash: string, port: number): boolean` - Announce for hash
|
|
208
|
+
- `announceForHash(contentHash: string, port: number, callback?: (peers: string[]) => void): boolean` - Announce for hash with optional peer discovery callback
|
|
209
209
|
|
|
210
210
|
#### Encryption
|
|
211
211
|
|
package/lib/index.d.ts
CHANGED
|
@@ -370,9 +370,10 @@ export class RatsClient {
|
|
|
370
370
|
* Announce availability for a content hash
|
|
371
371
|
* @param contentHash - Hash to announce for
|
|
372
372
|
* @param port - Port to announce
|
|
373
|
+
* @param callback - Optional callback to receive discovered peers during DHT traversal
|
|
373
374
|
* @returns true if announced successfully
|
|
374
375
|
*/
|
|
375
|
-
announceForHash(contentHash: string, port: number): boolean;
|
|
376
|
+
announceForHash(contentHash: string, port: number, callback?: (peers: string[]) => void): boolean;
|
|
376
377
|
|
|
377
378
|
// ============ mDNS ============
|
|
378
379
|
|
|
@@ -64,6 +64,15 @@ project(librats VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
|
|
64
64
|
set(CMAKE_CXX_STANDARD 17)
|
|
65
65
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
66
66
|
|
|
67
|
+
# Flags
|
|
68
|
+
# Compiler warnings configuration
|
|
69
|
+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
70
|
+
# additional checks by compiler to found errors ealy on
|
|
71
|
+
add_compile_options(-Wall -Wextra -Wpedantic)
|
|
72
|
+
# not show unused stuff, useful for development
|
|
73
|
+
add_compile_options(-Wno-unused-parameter -Wno-unused-variable -Wno-unused-but-set-variable)
|
|
74
|
+
endif()
|
|
75
|
+
|
|
67
76
|
# Options
|
|
68
77
|
option(RATS_BUILD_EXAMPLES "Build examples" ON)
|
|
69
78
|
option(RATS_BUILD_TESTS "Build unit tests" ON)
|