Use native iroh-blobs for CAS fetches
This commit is contained in:
parent
9d46dd4d0d
commit
72f28224ce
7 changed files with 199 additions and 39 deletions
|
|
@ -44,7 +44,7 @@ impl GethIrohConfig {
|
|||
local_discovery: true,
|
||||
bind_ipv4: None,
|
||||
bind_ipv6: None,
|
||||
alpns: default_protocol_router().alpns(),
|
||||
alpns: default_endpoint_alpns(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -161,6 +161,17 @@ pub fn default_protocol_descriptors() -> Vec<ProtocolDescriptor> {
|
|||
]
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn default_endpoint_alpns() -> Vec<Vec<u8>> {
|
||||
let mut alpns = default_protocol_router().alpns();
|
||||
alpns.push(iroh_blobs::ALPN.to_vec());
|
||||
alpns.push(iroh_docs::ALPN.to_vec());
|
||||
alpns.push(iroh_gossip::ALPN.to_vec());
|
||||
alpns.sort();
|
||||
alpns.dedup();
|
||||
alpns
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct NativeIrohLibrary {
|
||||
pub module: String,
|
||||
|
|
@ -447,6 +458,15 @@ mod tests {
|
|||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_endpoint_alpns_include_native_libraries() {
|
||||
let alpns = default_endpoint_alpns();
|
||||
assert!(alpns.contains(&ALPN_CONTROL.to_vec()));
|
||||
assert!(alpns.contains(&iroh_blobs::ALPN.to_vec()));
|
||||
assert!(alpns.contains(&iroh_docs::ALPN.to_vec()));
|
||||
assert!(alpns.contains(&iroh_gossip::ALPN.to_vec()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_router_registers_all_protocols() {
|
||||
let router = default_protocol_router();
|
||||
|
|
|
|||
Loading…
Reference in a new issue