feat: 初步支持 USB 网卡桥接;删除 OTG 端点预算管理

This commit is contained in:
mofeng-git
2026-07-16 19:19:24 +08:00
parent 63c2bb4ca2
commit 213359b6c8
35 changed files with 2367 additions and 727 deletions

View File

@@ -0,0 +1,34 @@
use std::sync::Arc;
use axum::{extract::State, Json};
use crate::config::OtgNetworkConfig;
use crate::error::Result;
use crate::otg::OtgNetworkStatus;
use crate::state::AppState;
use super::otg::update_otg_config_inner;
use super::types::{OtgConfigUpdate, OtgNetworkConfigUpdate};
pub async fn get_otg_network_config(State(state): State<Arc<AppState>>) -> Json<OtgNetworkConfig> {
Json(state.config.get().otg_network.clone())
}
pub async fn update_otg_network_config(
State(state): State<Arc<AppState>>,
Json(request): Json<OtgNetworkConfigUpdate>,
) -> Result<Json<OtgNetworkConfig>> {
let response = update_otg_config_inner(
&state,
OtgConfigUpdate {
network: Some(request),
..Default::default()
},
)
.await?;
Ok(Json(response.network))
}
pub async fn get_otg_network_status(State(state): State<Arc<AppState>>) -> Json<OtgNetworkStatus> {
Json(state.otg_service.network_status().await)
}