add IP Reflection to DHT for zero-infrastructure NAT traversal
bundled STUN. every DHT response now includes observed_addr field so nodes discover their public IP without external STUN servers
This commit is contained in:
@@ -44,6 +44,7 @@ const p2p_module = @import("p2p.zig");
|
||||
const P2P = p2p_module.P2P;
|
||||
const handleDataResponseCallback = p2p_module.handleDataResponseCallback;
|
||||
const registerNodeIdCallback = p2p_module.registerNodeIdCallback;
|
||||
const sendDhtMessageCallback = p2p_module.sendDhtMessageCallback;
|
||||
const P2PEvent = @import("events.zig").P2PEvent;
|
||||
const P2PConfig = @import("config.zig").P2PConfig;
|
||||
|
||||
@@ -221,6 +222,11 @@ pub fn startImpl(p2p: *P2P) Error!void {
|
||||
.register_fn = registerNodeIdCallback,
|
||||
.context = p2p,
|
||||
});
|
||||
// Wire the DHT message sender callback for simple binary format responses
|
||||
ctx.setDhtMessageSender(.{
|
||||
.send_fn = sendDhtMessageCallback,
|
||||
.context = p2p,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user