Support wireguard vpn portal (#43)

* support wireguard vpn portal
  user can use wireguard client to access easytier network

* add vpn portal cli

* clean logs

* avoid ospf msg too large
This commit is contained in:
Sijie.Sun
2024-03-30 22:15:14 +08:00
committed by GitHub
parent 90110aa587
commit 05cabb2651
17 changed files with 704 additions and 63 deletions
+20
View File
@@ -3,6 +3,7 @@
use std::{net::SocketAddr, vec};
use clap::{command, Args, Parser, Subcommand};
use rpc::vpn_portal_rpc_client::VpnPortalRpcClient;
mod arch;
mod common;
@@ -38,6 +39,7 @@ enum SubCommand {
Stun,
Route,
PeerCenter,
VpnPortal,
}
#[derive(Args, Debug)]
@@ -216,6 +218,12 @@ impl CommandHandler {
Ok(PeerCenterRpcClient::connect(self.addr.clone()).await?)
}
async fn get_vpn_portal_client(
&self,
) -> Result<VpnPortalRpcClient<tonic::transport::Channel>, Error> {
Ok(VpnPortalRpcClient::connect(self.addr.clone()).await?)
}
async fn list_peers(&self) -> Result<ListPeerResponse, Error> {
let mut client = self.get_peer_manager_client().await?;
let request = tonic::Request::new(ListPeerRequest::default());
@@ -452,6 +460,18 @@ async fn main() -> Result<(), Error> {
.to_string()
);
}
SubCommand::VpnPortal => {
let mut vpn_portal_client = handler.get_vpn_portal_client().await?;
let resp = vpn_portal_client
.get_vpn_portal_info(GetVpnPortalInfoRequest::default())
.await?
.into_inner()
.vpn_portal_info
.unwrap_or_default();
println!("portal_name: {}\n", resp.vpn_type);
println!("client_config:{}", resp.client_config);
println!("connected_clients:\n{:#?}", resp.connected_clients);
}
}
Ok(())