Skip to content

Commit c9e3085

Browse files
authored
feat(rust/hermes-ipfs): ipfs transport enable methods (#689)
* feat(hermes-ipfs): Add transport enable methods for P2P connectivity Add wrapper methods to enable TCP, QUIC, and DNS transports in HermesIpfsBuilder. These methods are required because connexa's TransportConfig disables all transports by default. - Add enable_tcp() method - Add enable_quic() method - Add enable_dns() method Without these methods, libp2p connections fail with "Multiaddr is not supported" errors. The methods must be called explicitly when building an IPFS node to enable P2P networking. Related to: #704 * chore(hermes-ipfs): Simplify connexa features to use 'full' Use the 'full' feature flag for connexa dependency instead of explicitly listing individual features. This is more maintainable and cleaner. Or if you prefer a shorter version: * chore(hermes-ipfs): Format cleanup and transport config notes Format where clauses and add TODO comments documenting disabled default transport config and TLS/websocket options.
1 parent 812c9a8 commit c9e3085

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

rust/hermes-ipfs/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ derive_more = {version = "2.0.1", features = ["from", "into", "display", "try_fr
2222
ipld-core = { version = "0.4.1", features = ["serde"]}
2323
# A fork of crates-io version with updated dependencies (`libp2p` and `ring` in particular).
2424
# rev-26b99cb as at July 30, 2025
25-
rust-ipfs = { version = "0.15.0", git = "https://github.com/dariusc93/rust-ipfs", rev = "0a6269e05a4ccfaa547a47a56f92171e4abc0564" }
25+
rust-ipfs = { version = "0.15.0", git = "https://github.com/dariusc93/rust-ipfs", rev = "0a6269e05a4ccfaa547a47a56f92171e4abc0564", features = ["tcp", "quic", "dns", "noise"] }
2626
tokio = "1.46.0"
2727
futures = "0.3.31"
2828
libp2p = "0.56.0"
29-
connexa = { version = "0.4.1", features = ["identify", "dcutr", "gossipsub", "autonat", "relay", "kad", "keypair_base64_encoding", "ping", "request-response", "request-response-misc", "rendezvous", "mdns"] }
29+
connexa = { version = "0.4.1", features = ["full"] }
3030
minicbor = { version = "0.25.1", features = ["alloc"], optional = true }
3131
ed25519-dalek = { version = "2.1.1", optional = true}
3232
catalyst-types = { version = "0.0.11", git = "https://github.com/input-output-hk/catalyst-libs.git", tag = "catalyst-types/v0.0.11", optional = true }

rust/hermes-ipfs/src/lib.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@ where N: NetworkBehaviour<ToSwarm = Infallible> + Send + Sync
7070
Self(self.0.set_default_listener())
7171
}
7272

73+
#[must_use]
74+
/// Enable TCP transport.
75+
pub fn enable_tcp(self) -> Self {
76+
Self(self.0.enable_tcp())
77+
}
78+
79+
#[must_use]
80+
/// Enable QUIC transport.
81+
pub fn enable_quic(self) -> Self {
82+
Self(self.0.enable_quic())
83+
}
84+
85+
#[must_use]
86+
/// Enable DNS resolution.
87+
pub fn enable_dns(self) -> Self {
88+
Self(self.0.enable_dns())
89+
}
90+
7391
#[must_use]
7492
/// Set the storage type for the IPFS node to local disk.
7593
///
@@ -110,7 +128,10 @@ impl HermesIpfs {
110128
///
111129
/// Returns an error if the IPFS daemon fails to start.
112130
pub async fn start() -> anyhow::Result<Self> {
113-
let node: Ipfs = HermesIpfsBuilder::<dummy::Behaviour>::new()
131+
let node = HermesIpfsBuilder::<dummy::Behaviour>::new()
132+
.enable_tcp()
133+
.enable_quic()
134+
.enable_dns()
114135
.with_default()
115136
.set_default_listener()
116137
// TODO(saibatizoku): Re-Enable default transport config when libp2p Cert bug is fixed

0 commit comments

Comments
 (0)