style: change style

This commit is contained in:
2020-09-06 00:33:57 +08:00
parent b0b9d16cf1
commit fcb4f51a82

View File

@@ -27,29 +27,24 @@ fn main() {
let program = args[0].clone(); let program = args[0].clone();
let mut opts = Options::new(); let mut opts = Options::new();
opts.reqopt("l", opts.reqopt("l", "local-port",
"local-port",
"The local port to which udpproxy should bind to", "The local port to which udpproxy should bind to",
"LOCAL_PORT"); "LOCAL_PORT");
opts.reqopt("r", opts.reqopt("r", "remote-port",
"remote-port",
"The remote port to which UDP packets should be forwarded", "The remote port to which UDP packets should be forwarded",
"REMOTE_PORT"); "REMOTE_PORT");
opts.reqopt("h", opts.reqopt("h", "host",
"host",
"The remote address to which packets will be forwarded", "The remote address to which packets will be forwarded",
"REMOTE_ADDR"); "REMOTE_ADDR");
opts.optopt("b", opts.optopt("b", "bind",
"bind",
"The address on which to listen for incoming requests", "The address on which to listen for incoming requests",
"BIND_ADDR"); "BIND_ADDR");
opts.optflag("d", "debug", "Enable debug mode"); opts.optflag("d", "debug", "Enable debug mode");
let matches = opts.parse(&args[1..]) let matches = opts.parse(&args[1..]).unwrap_or_else(|_| {
.unwrap_or_else(|_| { print_usage(&program, opts);
print_usage(&program, opts); std::process::exit(-1);
std::process::exit(-1); });
});
let local_port: i32 = matches.opt_str("l").unwrap().parse().unwrap(); let local_port: i32 = matches.opt_str("l").unwrap().parse().unwrap();
let remote_port: i32 = matches.opt_str("r").unwrap().parse().unwrap(); let remote_port: i32 = matches.opt_str("r").unwrap().parse().unwrap();