dariusc93 / rust-ipfs

The InterPlanetary File System (IPFS), implemented in Rust.
Apache License 2.0
36 stars 7 forks source link

feat: Support both noise and tls #209

Closed dariusc93 closed 1 month ago

dariusc93 commented 1 month ago

Currently, we only support using noise, however rust-libp2p does have support for tls, however there does not seem to be any easy way of using both at the same time. IntoSecurityUpgrade, which is used as apart of SwarmBuilder, is not exposed publicly, which means we would require to either:

  1. Write our own impl that would accept both noise and tls (or maybe have it so it would support one or the other, or both)
  2. Rewrite the logic to make use of SwarmBuilder
  3. Port over components of IntoSecurityUgrade into the transport module.

For 1, we could mimic what IntoSecurityUpgrade does, which would allow us to possibly add a configuration option to support either or (but panic if neither are used unless we decide to support plaintext). If we decide to go for 2, we would have to rethink the whole flow and how we wish to configure TLS and Noise and if we wish to move those options out of TransportConfig and into a separate configuration.