Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/http_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ impl Default for HTTPHrnResolver {
}
}

/// The "URL and Filename safe" Base64 Alphabet from RFC 4648
const B64_CHAR: [u8; 64] = [
b'A', b'B', b'C', b'D', b'E', b'F', b'G', b'H', b'I', b'J', b'K', b'L', b'M', b'N', b'O', b'P',
b'Q', b'R', b'S', b'T', b'U', b'V', b'W', b'X', b'Y', b'Z', b'a', b'b', b'c', b'd', b'e', b'f',
b'g', b'h', b'i', b'j', b'k', b'l', b'm', b'n', b'o', b'p', b'q', b'r', b's', b't', b'u', b'v',
b'w', b'x', b'y', b'z', b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9', b'+', b'/',
b'w', b'x', b'y', b'z', b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9', b'-', b'_',
];

#[rustfmt::skip]
Expand Down
18 changes: 14 additions & 4 deletions src/onion_message_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ fn channel() -> (ChannelSend, ChannelRecv) {
/// This implements LDK's [`DNSResolverMessageHandler`], which it uses to send onion messages and
/// process response messages.
///
/// Note that because this implementation does not assume an async runtime, queries which are not
/// responded to *may hang forever*. You must always wrap resolution futures to ensure they time
/// out properly, eg via `tokio::time::timeout`.
///
/// Note that after a query begines, [`PeerManager::process_events`] should be called to ensure the
/// query message goes out in a timely manner. You can call [`Self::register_post_queue_action`] to
/// have this happen automatically.
Expand Down Expand Up @@ -343,13 +347,19 @@ mod tests {
let peer_manager =
Arc::new(PeerManager::new(handlers, 0, &rand, &TestLogger, Arc::clone(&signer)));

// Connect to a static LDK node which we know will do DNS resolutions for us.
// Maintain a connection to a static LDK node which we know will do DNS resolutions for us.
let their_id_hex = "03db10aa09ff04d3568b0621750794063df401e6853c79a21a83e1a3f3b5bfb0c8";
let their_id = PublicKey::from_slice(&Vec::<u8>::from_hex(their_id_hex).unwrap()).unwrap();
let addr = "ldk-ln-node.bitcoin.ninja:9735".to_socket_addrs().unwrap().next().unwrap();
let _ = lightning_net_tokio::connect_outbound(Arc::clone(&peer_manager), their_id, addr)
.await
.unwrap();
let connect_pm = Arc::clone(&peer_manager);
tokio::spawn(async move {
loop {
lightning_net_tokio::connect_outbound(Arc::clone(&connect_pm), their_id, addr)
.await
.unwrap()
.await;
}
});

let pm_reference = Arc::clone(&peer_manager);
tokio::spawn(async move {
Expand Down
Loading