mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-07-29 11:51:44 +08:00
feat: VNC、RTSP 服务支持监听 ipv6 地址
This commit is contained in:
@@ -8,6 +8,7 @@ use tokio::sync::{broadcast, Mutex, RwLock};
|
||||
|
||||
use crate::config::RtspConfig;
|
||||
use crate::error::{AppError, Result};
|
||||
use crate::utils::{bind_socket_addr, bind_tcp_listener};
|
||||
use crate::video::VideoStreamManager;
|
||||
|
||||
use super::auth::{extract_basic_auth, rtsp_auth_credentials};
|
||||
@@ -73,13 +74,18 @@ impl RtspService {
|
||||
tracing::debug!("Failed to request keyframe on RTSP start: {}", err);
|
||||
}
|
||||
|
||||
let bind_addr: SocketAddr = format!("{}:{}", config.bind, config.port)
|
||||
.parse()
|
||||
let bind_addr = bind_socket_addr(&config.bind, config.port)
|
||||
.map_err(|e| AppError::BadRequest(format!("Invalid RTSP bind address: {}", e)))?;
|
||||
|
||||
let listener = TcpListener::bind(bind_addr).await.map_err(|e| {
|
||||
let listener = bind_tcp_listener(bind_addr).map_err(|e| {
|
||||
AppError::Io(io::Error::new(e.kind(), format!("RTSP bind failed: {}", e)))
|
||||
})?;
|
||||
let listener = TcpListener::from_std(listener).map_err(|e| {
|
||||
AppError::Io(io::Error::new(
|
||||
e.kind(),
|
||||
format!("RTSP listener setup failed: {}", e),
|
||||
))
|
||||
})?;
|
||||
|
||||
let service_config = self.config.clone();
|
||||
let video_manager = self.video_manager.clone();
|
||||
|
||||
Reference in New Issue
Block a user