mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 15:15:28 +00:00
Handle optional non-localhost endpoint in rust signaling server
This commit is contained in:
2
examples/signaling-server-rust/Cargo.lock
generated
2
examples/signaling-server-rust/Cargo.lock
generated
@ -348,7 +348,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701"
|
||||
|
||||
[[package]]
|
||||
name = "libdatachannel_signaling_example"
|
||||
name = "libdatachannel_signaling_server_example"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
|
@ -92,7 +92,9 @@ async fn handle(clients: ClientsMap, stream: TcpStream) {
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), std::io::Error> {
|
||||
let service = env::args().nth(1).unwrap_or("8000".to_string());
|
||||
let endpoint = format!("127.0.0.1:{}", service);
|
||||
let endpoint = if service.contains(':') { service } else { format!("127.0.0.1:{}", service) };
|
||||
|
||||
println!("Listening on {}", endpoint);
|
||||
|
||||
let mut listener = TcpListener::bind(endpoint)
|
||||
.await.expect("Listener binding failed");
|
||||
|
Reference in New Issue
Block a user