projects
/
hlquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3324112
)
Query multiple addresses from command line
author
MegaBrutal
<megabrutal+github@megabrutal.com>
Sat, 18 Feb 2023 00:40:00 +0000
(
01:40
+0100)
committer
MegaBrutal
<megabrutal+github@megabrutal.com>
Sat, 18 Feb 2023 00:40:00 +0000
(
01:40
+0100)
src/main.rs
patch
|
blob
|
history
diff --git
a/src/main.rs
b/src/main.rs
index 0255860911befdc723cb44f1c94cef499d2cce1a..4bd31f3a18c9b2f6f787620d1a98a23df9ef6255 100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-4,13
+4,13
@@
use a2s::A2SClient;
fn main() {
let client = A2SClient::new().unwrap();
- let addresses = args().
nth
(1)
- .
unwrap_or_else(|| String::from("localhost:27015"
))
- .
to_socket_addrs().unwrap()
- .flat_map(|sa| match sa {
- SocketAddr::V4(sa4) => Some(sa4),
- _ => None
-
}
);
+ let addresses = args().
skip
(1)
+ .
flat_map(|arg| arg.to_socket_addrs(
))
+ .
flat_map(|iter_addr| iter_addr.flat_map(|sa| match sa {
+ SocketAddr::V4(sa4) => Some(sa4),
+ _ => None
+ })
+ );
for address in addresses {