search for: socket_or_uri

Displaying 1 result from an estimated 1 matches for "socket_or_uri".

2023 Aug 20
1
[libnbd PATCH v8 04/10] rust: Make it possible to run examples with a URI
...if args.len() != 2 { anyhow::bail!("Usage: {:?} socket", args[0]); } - let socket = &args[1]; - // Connect to the NBD server over a - // Unix domain socket. - nbd.connect_unix(socket)?; + // Check if the user provided a URI or a unix socket. + let socket_or_uri = args[1].to_str().unwrap(); + if socket_or_uri.contains("://") { + nbd.connect_uri(socket_or_uri)?; + } else { + // Connect to the NBD server over a Unix domain socket. + nbd.connect_unix(socket_or_uri)?; + } // Read the first sector synchronously....