fix(server): filter out /quic in favor of /quic-v1

Configuration files generated by Kubo <= v0.22 list both `/quic` and `/quic-v1` listen addresses with the same UDP port. Given that we enable draft-29, the two addresses are treated the same by rust-libp2p's QUIC implementation. Though calling `listen_on` with both results in an "Address already in use" error by the OS on the second call. To prevent this from happening filter out `/quic` addresses in favor of `/quic-v1`.

Pull-Request: #4467.
This commit is contained in:
Max Inden
2023-09-12 05:03:38 +02:00
committed by GitHub
parent d1d358ca43
commit 0e64d71196
2 changed files with 10 additions and 5 deletions

View File

@ -8,6 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Add libp2p-lookup to Dockerfile to enable healthchecks. - Add libp2p-lookup to Dockerfile to enable healthchecks.
### Fixed
- Disable QUIC `draft-29` support.
Listening on `/quic` and `/quic-v1` addresses with the same port would otherwise result in an "Address already in use" error by the OS.
See [PR 4467].
[PR 4467]: https://github.com/libp2p/rust-libp2p/pull/4467
## [0.12.2] ## [0.12.2]
### Fixed ### Fixed
- Adhere to `--metrics-path` flag and listen on `0.0.0.0:8888` (default IPFS metrics port). - Adhere to `--metrics-path` flag and listen on `0.0.0.0:8888` (default IPFS metrics port).

View File

@ -89,11 +89,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
.multiplex(yamux::Config::default()) .multiplex(yamux::Config::default())
.timeout(Duration::from_secs(20)); .timeout(Duration::from_secs(20));
let quic_transport = { let quic_transport = quic::tokio::Transport::new(quic::Config::new(&local_keypair));
let mut config = quic::Config::new(&local_keypair);
config.support_draft_29 = true;
quic::tokio::Transport::new(config)
};
dns::TokioDnsConfig::system(libp2p::core::transport::OrTransport::new( dns::TokioDnsConfig::system(libp2p::core::transport::OrTransport::new(
quic_transport, quic_transport,
@ -126,6 +122,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
Err(e) => return Err(e.into()), Err(e) => return Err(e.into()),
} }
} }
if config.addresses.append_announce.is_empty() { if config.addresses.append_announce.is_empty() {
warn!("No external addresses configured."); warn!("No external addresses configured.");
} }