ftnet_utils/
lib.rs

1extern crate self as ftnet_utils;
2
3pub mod get_endpoint;
4mod get_stream;
5pub mod http;
6mod http_connection_manager;
7mod http_to_peer;
8mod peer_to_http;
9mod peer_to_tcp;
10pub mod protocol;
11mod secret;
12mod utils;
13
14#[cfg(feature = "keyring")]
15pub use secret::KeyringSecretStore;
16
17pub use get_endpoint::get_endpoint;
18pub use get_stream::{PeerStreamSenders, get_stream};
19pub use http::ProxyResult;
20pub use http_connection_manager::{HttpConnectionManager, HttpConnectionPool, HttpConnectionPools};
21pub use http_to_peer::http_to_peer;
22pub use peer_to_http::peer_to_http;
23pub use peer_to_tcp::peer_to_tcp;
24pub use protocol::{APNS_IDENTITY, Protocol};
25pub use secret::{SecretStore, read_or_create_key};
26pub use utils::{
27    FrameReader, accept_bi, frame_reader, get_remote_id52, id52_to_public_key, public_key_to_id52,
28};
29
30/// IDMap stores the fastn port and the endpoint for every identity
31///
32/// why is it a Vec and not a HasMap? the incoming requests contain the first few characters of id
33/// and not the full id. the reason for this is we want to use <id>.localhost.direct as well, and
34/// subdomain can be max 63 char long, and our ids are 64 chars. if we use <id>.ftnet, then this
35/// will not be a problem. we still do prefix match instead of exact match just to be sure.
36///
37/// since the number of identities will be small, a prefix match is probably going to be the same
38/// speed as the hash map exact lookup.
39pub type IDMap = std::sync::Arc<tokio::sync::Mutex<Vec<(String, (u16, iroh::endpoint::Endpoint))>>>;
40
41const ACK: &str = "ack";