Add source-based routing support (#862)

* Add source-based routing support

* include neighbors in ANNOUNCE

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
jack
2025-10-28 12:38:44 +01:00
committed by GitHub
co-authored by jack callebtc
parent 2edbe2bbbd
commit 01256f3041
9 changed files with 504 additions and 26 deletions
+21 -1
View File
@@ -217,7 +217,27 @@ struct PeerIDTests {
let short = peerID.toShort()
#expect(short == peerID)
}
@Test func routingData_fromShortID() throws {
let peerID = PeerID(str: hex16)
let routing = try #require(peerID.routingData)
#expect(routing.count == 8)
#expect(routing == Data(hexString: hex16))
}
@Test func routingData_fromNoiseKey() throws {
let peerID = PeerID(str: hex64)
let routing = try #require(peerID.routingData)
let expectedShort = peerID.toShort()
#expect(routing == Data(hexString: expectedShort.id))
}
@Test func routingPeerRoundTrip() throws {
let raw = try #require(Data(hexString: hex16))
let peerID = try #require(PeerID(routingData: raw))
#expect(peerID.routingData == raw)
}
// MARK: - Codable
@Test func codable_emptyPrefix() throws {