use uint32 as peer id (#29)
This commit is contained in:
@@ -3,9 +3,7 @@ use std::{net::Ipv4Addr, sync::Arc};
|
||||
use async_trait::async_trait;
|
||||
use tokio_util::bytes::Bytes;
|
||||
|
||||
use crate::common::error::Error;
|
||||
|
||||
use super::PeerId;
|
||||
use crate::common::{error::Error, PeerId};
|
||||
|
||||
#[async_trait]
|
||||
pub trait RouteInterface {
|
||||
@@ -14,8 +12,9 @@ pub trait RouteInterface {
|
||||
&self,
|
||||
msg: Bytes,
|
||||
route_id: u8,
|
||||
dst_peer_id: &PeerId,
|
||||
dst_peer_id: PeerId,
|
||||
) -> Result<(), Error>;
|
||||
fn my_peer_id(&self) -> PeerId;
|
||||
}
|
||||
|
||||
pub type RouteInterfaceBox = Box<dyn RouteInterface + Send + Sync>;
|
||||
@@ -26,7 +25,7 @@ pub trait Route {
|
||||
async fn open(&self, interface: RouteInterfaceBox) -> Result<u8, ()>;
|
||||
async fn close(&self);
|
||||
|
||||
async fn get_next_hop(&self, peer_id: &PeerId) -> Option<PeerId>;
|
||||
async fn get_next_hop(&self, peer_id: PeerId) -> Option<PeerId>;
|
||||
async fn list_routes(&self) -> Vec<crate::rpc::Route>;
|
||||
|
||||
async fn get_peer_id_by_ipv4(&self, _ipv4: &Ipv4Addr) -> Option<PeerId> {
|
||||
|
||||
Reference in New Issue
Block a user