Skip to content

Commit efbaa5b

Browse files
committed
feat: make relay identify protocol const
1 parent f7590f0 commit efbaa5b

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/relay-server/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ rand.workspace = true
2020
charon-tracing.workspace = true
2121
tracing.workspace = true
2222
charon-p2p.workspace = true
23+
charon-core.workspace = true
2324

2425
[dev-dependencies]
2526
vise-exporter.workspace = true

crates/relay-server/src/behaviour.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#![allow(missing_docs)] // we need to allow missing docs for the derive macro
22
//! Relay server behaviour.
33
4+
use std::sync::LazyLock;
5+
46
use libp2p::{identify, identity::Keypair, ping, relay, swarm::NetworkBehaviour};
57

68
use charon_p2p::gater::ConnGater;
@@ -38,11 +40,15 @@ pub struct RelayServerBehaviourBuilder {
3840
user_agent: Option<String>,
3941
}
4042

43+
/// The default identify protocol for the Pluto network.
44+
pub static DEFAULT_IDENTIFY_PROTOCOL: LazyLock<String> =
45+
LazyLock::new(|| format!("/pluto/relay/{}", *charon_core::version::VERSION));
46+
4147
impl Default for RelayServerBehaviourBuilder {
4248
fn default() -> Self {
4349
Self {
4450
gater: None,
45-
identify_protocol: "/pluto/relay/1.0.0-alpha".into(),
51+
identify_protocol: DEFAULT_IDENTIFY_PROTOCOL.clone(),
4652
relay_config: None,
4753
user_agent: None,
4854
}

0 commit comments

Comments
 (0)