Type Alias IDMap

Source
pub type IDMap = Arc<Mutex<Vec<(String, (u16, Endpoint))>>>;
Expand description

IDMap stores the fastn port and the endpoint for every identity

why is it a Vec and not a HasMap? the incoming requests contain the first few characters of id and not the full id. the reason for this is we want to use .localhost.direct as well, and subdomain can be max 63 char long, and our ids are 64 chars. if we use .ftnet, then this will not be a problem. we still do prefix match instead of exact match just to be sure.

since the number of identities will be small, a prefix match is probably going to be the same speed as the hash map exact lookup.

Aliased Typeยง

pub struct IDMap { /* private fields */ }