mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 03:03:46 +08:00
chore: update
This commit is contained in:
parent
ad335ba005
commit
6b349eda45
@ -5,6 +5,12 @@ use serde::{Deserialize, Serialize};
|
||||
use serde_yaml::Mapping;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq)]
|
||||
pub struct Rate {
|
||||
pub up: u64,
|
||||
pub down: u64,
|
||||
}
|
||||
|
||||
/// PUT /configs
|
||||
/// path 是绝对路径
|
||||
pub async fn put_configs(path: &str) -> Result<()> {
|
||||
|
@ -1,6 +1,7 @@
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub mod speed_rate;
|
||||
use crate::core::clash_api::Rate;
|
||||
use crate::utils::dirs;
|
||||
use crate::{
|
||||
cmds,
|
||||
@ -15,7 +16,6 @@ use futures::StreamExt;
|
||||
use parking_lot::Mutex;
|
||||
#[cfg(target_os = "macos")]
|
||||
use parking_lot::RwLock;
|
||||
use speed_rate::Rate;
|
||||
#[cfg(target_os = "macos")]
|
||||
pub use speed_rate::{SpeedRate, Traffic};
|
||||
#[cfg(target_os = "macos")]
|
||||
|
@ -1,31 +1,20 @@
|
||||
#[cfg(target_os = "macos")]
|
||||
use {
|
||||
crate::core::clash_api::get_traffic_ws_url,
|
||||
crate::utils::help::format_bytes_speed,
|
||||
anyhow::Result,
|
||||
futures::Stream,
|
||||
image::{ImageBuffer, Rgba},
|
||||
imageproc::drawing::draw_text_mut,
|
||||
parking_lot::Mutex,
|
||||
rusttype::{Font, Scale},
|
||||
std::io::Cursor,
|
||||
std::sync::Arc,
|
||||
tokio_tungstenite::tungstenite::Message,
|
||||
};
|
||||
use crate::core::clash_api::{get_traffic_ws_url, Rate};
|
||||
use crate::utils::help::format_bytes_speed;
|
||||
use anyhow::Result;
|
||||
use futures::Stream;
|
||||
use image::{ImageBuffer, Rgba};
|
||||
use imageproc::drawing::draw_text_mut;
|
||||
use parking_lot::Mutex;
|
||||
use rusttype::{Font, Scale};
|
||||
use std::io::Cursor;
|
||||
use std::sync::Arc;
|
||||
use tokio_tungstenite::tungstenite::Message;
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq)]
|
||||
pub struct Rate {
|
||||
pub up: u64,
|
||||
pub down: u64,
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SpeedRate {
|
||||
rate: Arc<Mutex<(Rate, Rate)>>,
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
impl SpeedRate {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
@ -142,14 +131,12 @@ impl SpeedRate {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Traffic {
|
||||
pub up: u64,
|
||||
pub down: u64,
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
impl Traffic {
|
||||
pub async fn get_traffic_stream() -> Result<impl Stream<Item = Result<Traffic, anyhow::Error>>>
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user