Add bind-interface configuration option for network binding

Co-authored-by: rustdesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-05 03:49:20 +00:00
parent ef59778720
commit 1b87c33fdc

View File

@@ -769,7 +769,13 @@ async fn direct_server(server: ServerPtr) {
) || option2bool("stop-service", &Config::get_option("stop-service"));
if !disabled && listener.is_none() {
port = get_direct_port();
match hbb_common::tcp::listen_any(port as _).await {
let bind_interface = Config::get_bind_interface();
let result = if bind_interface.is_empty() {
hbb_common::tcp::listen_any(port as _).await
} else {
hbb_common::tcp::listen_on(&bind_interface, port as _).await
};
match result {
Ok(l) => {
listener = Some(l);
log::info!(