protocols/autonat: Export DEFAULT_PROTOCOL_NAME (#2717)

This commit is contained in:
Friedel Ziegelmayer
2022-06-22 05:36:20 +02:00
committed by GitHub
parent cb3784a8b3
commit e2bef93bd7
4 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,7 @@
# 0.4.1
- Export `DEFAULT_PROTOCOL_NAME`.
# 0.4.0 # 0.4.0
- Update to `libp2p-core` `v0.33.0`. - Update to `libp2p-core` `v0.33.0`.

View File

@ -3,7 +3,7 @@ name = "libp2p-autonat"
edition = "2021" edition = "2021"
rust-version = "1.56.1" rust-version = "1.56.1"
description = "NAT and firewall detection for libp2p" description = "NAT and firewall detection for libp2p"
version = "0.4.0" version = "0.4.1"
authors = ["David Craven <david@craven.ch>", "Elena Frank <elena.frank@protonmail.com>"] authors = ["David Craven <david@craven.ch>", "Elena Frank <elena.frank@protonmail.com>"]
license = "MIT" license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p" repository = "https://github.com/libp2p/rust-libp2p"

View File

@ -27,7 +27,7 @@ pub use self::{
Behaviour, Config, Event, InboundProbeError, InboundProbeEvent, NatStatus, Behaviour, Config, Event, InboundProbeError, InboundProbeEvent, NatStatus,
OutboundProbeError, OutboundProbeEvent, ProbeId, OutboundProbeError, OutboundProbeEvent, ProbeId,
}, },
protocol::ResponseError, protocol::{ResponseError, DEFAULT_PROTOCOL_NAME},
}; };
pub use libp2p_request_response::{InboundFailure, OutboundFailure}; pub use libp2p_request_response::{InboundFailure, OutboundFailure};

View File

@ -29,9 +29,12 @@ use std::{convert::TryFrom, io};
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct AutoNatProtocol; pub struct AutoNatProtocol;
/// The protocol name used for negotiating with multistream-select.
pub const DEFAULT_PROTOCOL_NAME: &[u8] = b"/libp2p/autonat/1.0.0";
impl ProtocolName for AutoNatProtocol { impl ProtocolName for AutoNatProtocol {
fn protocol_name(&self) -> &[u8] { fn protocol_name(&self) -> &[u8] {
b"/libp2p/autonat/1.0.0" DEFAULT_PROTOCOL_NAME
} }
} }