From 763e1346dd158ced6235b45406074dbadae482c4 Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 28 Jan 2026 22:04:45 +0000 Subject: [PATCH] send user agent --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ab4caff..6194d56 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ use tokio_tungstenite::{ connect_async_with_config, tungstenite::{ client::IntoClientRequest, - http::header::{AUTHORIZATION, HeaderValue}, + http::header::{AUTHORIZATION, HeaderValue, USER_AGENT}, Message, }, }; @@ -69,6 +69,11 @@ async fn main() -> Result<(), Box> { request.headers_mut().insert(AUTHORIZATION, auth_value); } + let user_agent = format!("{}/{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")); + request + .headers_mut() + .insert(USER_AGENT, HeaderValue::from_str(&user_agent).unwrap()); + info!("[{}] Connecting to {}", letter, url); if debug_enabled {