@@ -1,5 +1,6 @@
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use axum::{response::IntoResponse, routing::get, Router};
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
#[derive(Parser)]
|
||||
@@ -44,8 +45,16 @@ async fn main() -> anyhow::Result<()> {
|
||||
async fn handle_command(cmd: Command) -> anyhow::Result<()> {
|
||||
match cmd.command {
|
||||
Some(Commands::Daemon { host }) => {
|
||||
tracing::info!("starting agent server on {}", host);
|
||||
tokio::time::sleep(std::time::Duration::from_secs(60)).await;
|
||||
tracing::info!("Starting churn server");
|
||||
|
||||
let app = Router::new().route("/ping", get(ping));
|
||||
|
||||
tracing::info!("churn server listening on {}", host);
|
||||
axum::Server::bind(&host)
|
||||
.serve(app.into_make_service())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Some(Commands::Connect {
|
||||
@@ -56,3 +65,7 @@ async fn handle_command(cmd: Command) -> anyhow::Result<()> {
|
||||
None => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
async fn ping() -> impl IntoResponse {
|
||||
"pong!"
|
||||
}
|
||||
|
Reference in New Issue
Block a user