feat: 初始化项目结构并添加位置上报相关功能

This commit is contained in:
2025-07-28 23:29:21 +08:00
parent 86e4f1acdf
commit f87786fd3a
22 changed files with 128 additions and 46 deletions

View File

@@ -0,0 +1,26 @@
mod utils;
use futures::StreamExt;
use log::info;
use tokio_tungstenite::connect_async;
use utils::logger;
#[tokio::main]
async fn main() {
logger::init_logger();
const WS: &str = "wss://home.hzer.xyz/gotify/stream?token=CDIwYlYJuxWxVr5";
match connect_async(WS).await {
Ok((stream, _)) => {
info!("Connected to Gotify server {WS}");
let (_, mut read) = stream.split();
while let Some(msg) = read.next().await {
info!("Received message: {msg:?}");
}
}
Err(e) => {
info!("Failed to connect to Gotify server: {e}");
}
}
}

View File

@@ -0,0 +1,5 @@
use env_logger::{Builder, Env};
pub fn init_logger(){
Builder::from_env(Env::default().default_filter_or("info")).init();
}

View File

@@ -0,0 +1 @@
pub mod logger;