mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 10:14:35 +00:00
use customized rpc implementation, remove Tarpc & Tonic (#348)
This patch removes Tarpc & Tonic GRPC and implements a customized rpc framework, which can be used by peer rpc and cli interface. web config server can also use this rpc framework. moreover, rewrite the public server logic, use ospf route to implement public server based networking. this make public server mesh possible.
This commit is contained in:
@@ -5,7 +5,10 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilte
|
||||
|
||||
use crate::{
|
||||
common::{config::ConfigLoader, get_logger_timer_rfc3339},
|
||||
rpc::cli::{NatType, PeerInfo, Route},
|
||||
proto::{
|
||||
cli::{PeerInfo, Route},
|
||||
common::NatType,
|
||||
},
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -114,17 +117,11 @@ pub fn list_peer_route_pair(peers: Vec<PeerInfo>, routes: Vec<Route>) -> Vec<Pee
|
||||
|
||||
for route in routes.iter() {
|
||||
let peer = peers.iter().find(|peer| peer.peer_id == route.peer_id);
|
||||
let has_tunnel = peer.map(|p| !p.conns.is_empty()).unwrap_or(false);
|
||||
let mut pair = PeerRoutePair {
|
||||
let pair = PeerRoutePair {
|
||||
route: route.clone(),
|
||||
peer: peer.cloned(),
|
||||
};
|
||||
|
||||
// it is relayed by public server, adjust the cost
|
||||
if !has_tunnel && pair.route.cost == 1 {
|
||||
pair.route.cost = 2;
|
||||
}
|
||||
|
||||
pairs.push(pair);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user