chore(rust): tidier libpk::main macro impl

This commit is contained in:
alyssa 2025-05-17 16:19:30 +00:00
parent 7737850afb
commit f9a6c2cefe
18 changed files with 90 additions and 64 deletions

View file

@ -6,6 +6,7 @@ edition = "2021"
[dependencies]
anyhow = { workspace = true }
axum = { workspace = true }
libpk = { path = "../libpk" }
reqwest = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }

View file

@ -19,17 +19,8 @@ use axum::{extract::State, http::Uri, routing::post, Json, Router};
mod logger;
// this package does not currently use libpk
#[tokio::main]
#[libpk::main]
async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt()
.json()
.with_env_filter(EnvFilter::from_default_env())
.init();
info!("hello world");
let address = std::env::var("DNS_UPSTREAM").unwrap().parse().unwrap();
let stream = UdpClientStream::<UdpSocket>::with_timeout(address, Duration::from_secs(3));
let (client, bg) = AsyncClient::connect(stream).await?;