mirror of
https://github.com/hinto-janai/cuprate.git
synced 2025-01-24 19:35:57 +00:00
rpc: fix tests
This commit is contained in:
parent
2085749824
commit
d9787f95ff
3 changed files with 16 additions and 6 deletions
|
@ -164,7 +164,7 @@ impl AccessResponseBase {
|
||||||
/// use cuprate_rpc_types::{misc::*, base::*};
|
/// use cuprate_rpc_types::{misc::*, base::*};
|
||||||
///
|
///
|
||||||
/// assert_eq!(AccessResponseBase::OK_UNTRUSTED, AccessResponseBase {
|
/// assert_eq!(AccessResponseBase::OK_UNTRUSTED, AccessResponseBase {
|
||||||
/// response_base: ResponseBase::ok_untrusted(),
|
/// response_base: ResponseBase::OK_UNTRUSTED,
|
||||||
/// credits: 0,
|
/// credits: 0,
|
||||||
/// top_hash: "".into(),
|
/// top_hash: "".into(),
|
||||||
/// });
|
/// });
|
||||||
|
|
|
@ -658,7 +658,7 @@ define_request_and_response! {
|
||||||
connections: vec![
|
connections: vec![
|
||||||
ConnectionInfo {
|
ConnectionInfo {
|
||||||
address: "3evk3kezfjg44ma6tvesy7rbxwwpgpympj45xar5fo4qajrsmkoaqdqd.onion:18083".into(),
|
address: "3evk3kezfjg44ma6tvesy7rbxwwpgpympj45xar5fo4qajrsmkoaqdqd.onion:18083".into(),
|
||||||
address_type: 4,
|
address_type: cuprate_rpc_types::misc::AddressType::Tor,
|
||||||
avg_download: 0,
|
avg_download: 0,
|
||||||
avg_upload: 0,
|
avg_upload: 0,
|
||||||
connection_id: "22ef856d0f1d44cc95e84fecfd065fe2".into(),
|
connection_id: "22ef856d0f1d44cc95e84fecfd065fe2".into(),
|
||||||
|
@ -685,7 +685,7 @@ define_request_and_response! {
|
||||||
},
|
},
|
||||||
ConnectionInfo {
|
ConnectionInfo {
|
||||||
address: "4iykytmumafy5kjahdqc7uzgcs34s2vwsadfjpk4znvsa5vmcxeup2qd.onion:18083".into(),
|
address: "4iykytmumafy5kjahdqc7uzgcs34s2vwsadfjpk4znvsa5vmcxeup2qd.onion:18083".into(),
|
||||||
address_type: 4,
|
address_type: cuprate_rpc_types::misc::AddressType::Tor,
|
||||||
avg_download: 0,
|
avg_download: 0,
|
||||||
avg_upload: 0,
|
avg_upload: 0,
|
||||||
connection_id: "c7734e15936f485a86d2b0534f87e499".into(),
|
connection_id: "c7734e15936f485a86d2b0534f87e499".into(),
|
||||||
|
@ -1251,7 +1251,7 @@ define_request_and_response! {
|
||||||
SyncInfoPeer {
|
SyncInfoPeer {
|
||||||
info: ConnectionInfo {
|
info: ConnectionInfo {
|
||||||
address: "142.93.128.65:44986".into(),
|
address: "142.93.128.65:44986".into(),
|
||||||
address_type: 1,
|
address_type: AddressType::Ipv4,
|
||||||
avg_download: 1,
|
avg_download: 1,
|
||||||
avg_upload: 1,
|
avg_upload: 1,
|
||||||
connection_id: "a5803c4c2dac49e7b201dccdef54c862".into(),
|
connection_id: "a5803c4c2dac49e7b201dccdef54c862".into(),
|
||||||
|
@ -1280,7 +1280,7 @@ define_request_and_response! {
|
||||||
SyncInfoPeer {
|
SyncInfoPeer {
|
||||||
info: ConnectionInfo {
|
info: ConnectionInfo {
|
||||||
address: "4iykytmumafy5kjahdqc7uzgcs34s2vwsadfjpk4znvsa5vmcxeup2qd.onion:18083".into(),
|
address: "4iykytmumafy5kjahdqc7uzgcs34s2vwsadfjpk4znvsa5vmcxeup2qd.onion:18083".into(),
|
||||||
address_type: 4,
|
address_type: AddressType::Tor,
|
||||||
avg_download: 0,
|
avg_download: 0,
|
||||||
avg_upload: 0,
|
avg_upload: 0,
|
||||||
connection_id: "277f7c821bc546878c8bd29977e780f5".into(),
|
connection_id: "277f7c821bc546878c8bd29977e780f5".into(),
|
||||||
|
|
|
@ -20,7 +20,7 @@ use cuprate_epee_encoding::{
|
||||||
)]
|
)]
|
||||||
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(untagged))]
|
#[cfg_attr(feature = "serde", serde(untagged, try_from = "u8", into = "u8"))]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum AddressType {
|
pub enum AddressType {
|
||||||
#[default]
|
#[default]
|
||||||
|
@ -80,6 +80,16 @@ impl From<AddressType> for u8 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl TryFrom<u8> for AddressType {
|
||||||
|
type Error = u8;
|
||||||
|
fn try_from(value: u8) -> Result<Self, Self::Error> {
|
||||||
|
match Self::from_u8(value) {
|
||||||
|
Some(s) => Ok(s),
|
||||||
|
None => Err(value),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "epee")]
|
#[cfg(feature = "epee")]
|
||||||
impl EpeeValue for AddressType {
|
impl EpeeValue for AddressType {
|
||||||
const MARKER: Marker = u8::MARKER;
|
const MARKER: Marker = u8::MARKER;
|
||||||
|
|
Loading…
Reference in a new issue