Skip to main content

fuel_core_p2p/request_response/
protocols.rs

1use strum_macros::EnumIter;
2
3pub(crate) const V1_REQUEST_RESPONSE_PROTOCOL_ID: &str = "/fuel/req_res/0.0.1";
4pub(crate) const V2_REQUEST_RESPONSE_PROTOCOL_ID: &str = "/fuel/req_res/0.0.2";
5
6#[derive(Debug, Clone, EnumIter)]
7pub enum RequestResponseProtocol {
8    V1,
9    V2,
10}
11
12impl AsRef<str> for RequestResponseProtocol {
13    fn as_ref(&self) -> &str {
14        match self {
15            RequestResponseProtocol::V1 => V1_REQUEST_RESPONSE_PROTOCOL_ID,
16            RequestResponseProtocol::V2 => V2_REQUEST_RESPONSE_PROTOCOL_ID,
17        }
18    }
19}