This commit is contained in:
parent
cf3cccd3ca
commit
04760fd88d
15 changed files with 136 additions and 20 deletions
|
|
@ -150,8 +150,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
tokio::spawn(async move {
|
||||
let desc = conn.description.as_deref().unwrap_or("(no description)");
|
||||
println!(
|
||||
"\n--- New connection (version {}, description: {desc}) ---",
|
||||
conn.version
|
||||
"\n--- New connection (version {}, remote: {}, description: {desc}) ---",
|
||||
conn.version,
|
||||
conn.remote_addr
|
||||
.map(|addr| addr.to_string())
|
||||
.unwrap_or_else(|| "unknown".into())
|
||||
);
|
||||
println!("Client ID: {}", conn.client_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ use tokio::{
|
|||
};
|
||||
use tokio_rustls::TlsAcceptor;
|
||||
|
||||
async fn ok(_request: Http3Request, response: Http3Response) -> Http3Response {
|
||||
async fn ok(request: Http3Request, response: Http3Response) -> Http3Response {
|
||||
response
|
||||
.header("content-type", "text/plain; charset=utf-8")
|
||||
.body("OK")
|
||||
.body(format!("OK\nclient: {}\n", request.remote_addr))
|
||||
}
|
||||
|
||||
async fn profile(
|
||||
_request: Http3Request,
|
||||
request: Http3Request,
|
||||
response: Http3Response,
|
||||
params: RouteParams,
|
||||
) -> Http3Response {
|
||||
|
|
@ -30,6 +30,7 @@ async fn profile(
|
|||
|
||||
let body = serde_json::json!({
|
||||
"user": user,
|
||||
"remote_addr": request.remote_addr.to_string(),
|
||||
"profile": {
|
||||
"display_name": format!("Example user {user}"),
|
||||
"status": "active"
|
||||
|
|
|
|||
Loading…
Reference in a new issue