You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main.rs
+52-24Lines changed: 52 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ use std::{
17
17
rc::Rc,
18
18
sync::Arc,
19
19
};
20
-
20
+
use std::collections::HashMap;
21
21
use clap::Parser;
22
22
use home::home_dir;
23
23
use rustyline::error::ReadlineError;
@@ -126,13 +126,19 @@ fn main() {
126
126
println!("{}",VERSION);
127
127
exit(ExitCode::Successasi32);
128
128
}
129
-
let address = match args.address{
130
-
Some(address) => address,
131
-
None => {
132
-
println_error!("missing server address ('{}').", format_argument!("--address <{ADDRESS_VALUE_NAME}>"));
133
-
exit(ExitCode::UserInputErrorasi32);
134
-
}
135
-
};
129
+
let address_info = parse_addresses(&args);
130
+
if !args.tls_disabled && !address_info.only_https{
131
+
println_error!(
132
+
"\
133
+
TLS connections can only be enabled when connecting to HTTPS endpoints. \
134
+
For example, using 'https://<ip>:port'.\n\
135
+
Please modify the address or disable TLS ('{}'). {}\
136
+
",
137
+
format_argument!("--tls-disabled"),
138
+
format_warning!("WARNING: this will send passwords over plaintext!"),
139
+
);
140
+
exit(ExitCode::UserInputErrorasi32);
141
+
}
136
142
let username = match args.username{
137
143
Some(username) => username,
138
144
None => {
@@ -146,28 +152,16 @@ fn main() {
146
152
if args.password.is_none(){
147
153
args.password = Some(LineReaderHidden::new().readline(&format!("password for '{username}': ")));
148
154
}
149
-
if !args.diagnostics_disable{
155
+
if !args.diagnostics_disabled{
150
156
init_diagnostics()
151
157
}
152
-
if !args.tls_disabled && !address.starts_with("https:"){
153
-
println_error!(
154
-
"\
155
-
TLS connections can only be enabled when connecting to HTTPS endpoints. \
156
-
For example, using 'https://<ip>:port'.\n\
157
-
Please modify the address or disable TLS ('{}'). {}\
158
-
",
159
-
format_argument!("--tls-disabled"),
160
-
format_warning!("WARNING: this will send passwords over plaintext!"),
161
-
);
162
-
exit(ExitCode::UserInputErrorasi32);
163
-
}
164
158
let tls_root_ca_path = args.tls_root_ca.as_ref().map(|value| Path::new(value));
165
-
166
159
let runtime = BackgroundRuntime::new();
160
+
let driver_options = DriverOptions::new().use_replication(!args.replication_disabled).tls_enabled(!args.tls_disabled).tls_root_ca(tls_root_ca_path).unwrap();
0 commit comments