88
88
//! # fn main() -> Result<()> {
89
89
//! // See: https://questdb.io/docs/reference/api/ilp/authenticate
90
90
//! let mut sender = SenderBuilder::new_tcp("localhost", 9009)
91
- //! .user ("testUser1")? // kid
91
+ //! .username ("testUser1")? // kid
92
92
//! .token("5UjEMuA0Pj5pjK8a-fa24dyIf-Es5mYny3oE_Wmus48")? // d
93
93
//! .token_x("fLKYEaoEb9lrn3nkwLDA-M_xnuFOdSt9y0Z7_vWSHLU")? // x
94
94
//! .token_y("Dt5tbS1dEDMSYfym3fgMv0B99szno-dFc1rYF9t0aac")? // y
@@ -1704,8 +1704,8 @@ pub struct SenderBuilder {
1704
1704
net_interface : ConfigSetting < Option < String > > ,
1705
1705
max_buf_size : ConfigSetting < usize > ,
1706
1706
auth_timeout : ConfigSetting < Duration > ,
1707
- user : ConfigSetting < Option < String > > ,
1708
- pass : ConfigSetting < Option < String > > ,
1707
+ username : ConfigSetting < Option < String > > ,
1708
+ password : ConfigSetting < Option < String > > ,
1709
1709
token : ConfigSetting < Option < String > > ,
1710
1710
token_x : ConfigSetting < Option < String > > ,
1711
1711
token_y : ConfigSetting < Option < String > > ,
@@ -1724,7 +1724,7 @@ pub struct SenderBuilder {
1724
1724
impl SenderBuilder {
1725
1725
/// Create a new `SenderBuilder` instance from configuration string.
1726
1726
///
1727
- /// The format of the string is: `"http::addr=host:port;ket =value;...;"`.
1727
+ /// The format of the string is: `"http::addr=host:port;key =value;...;"`.
1728
1728
///
1729
1729
/// Alongside `"http"` you can also specify `"https"`, `"tcp"`, and `"tcps"`.
1730
1730
///
@@ -1734,7 +1734,7 @@ impl SenderBuilder {
1734
1734
///
1735
1735
/// The accepted set of keys and values is the same as for the `SenderBuilder`'s API.
1736
1736
///
1737
- /// E.g. `"http::addr=host:port;user =alice;password=secret;tls_ca=os_roots;"`.
1737
+ /// E.g. `"http::addr=host:port;username =alice;password=secret;tls_ca=os_roots;"`.
1738
1738
///
1739
1739
/// If you prefer, you can also load the configuration from an environment variable.
1740
1740
/// See [`SenderBuilder::from_env`].
@@ -1780,8 +1780,8 @@ impl SenderBuilder {
1780
1780
1781
1781
for ( key, val) in params. iter ( ) . map ( |( k, v) | ( k. as_str ( ) , v. as_str ( ) ) ) {
1782
1782
builder = match key {
1783
- "user " => builder. user ( val) ?,
1784
- "pass " => builder. pass ( val) ?,
1783
+ "username " => builder. username ( val) ?,
1784
+ "password " => builder. password ( val) ?,
1785
1785
"token" => builder. token ( val) ?,
1786
1786
"token_x" => builder. token_x ( val) ?,
1787
1787
"token_y" => builder. token_y ( val) ?,
@@ -1918,8 +1918,8 @@ impl SenderBuilder {
1918
1918
net_interface : ConfigSetting :: new_default ( None ) ,
1919
1919
max_buf_size : ConfigSetting :: new_default ( 100 * 1024 * 1024 ) ,
1920
1920
auth_timeout : ConfigSetting :: new_default ( Duration :: from_secs ( 15 ) ) ,
1921
- user : ConfigSetting :: new_default ( None ) ,
1922
- pass : ConfigSetting :: new_default ( None ) ,
1921
+ username : ConfigSetting :: new_default ( None ) ,
1922
+ password : ConfigSetting :: new_default ( None ) ,
1923
1923
token : ConfigSetting :: new_default ( None ) ,
1924
1924
token_x : ConfigSetting :: new_default ( None ) ,
1925
1925
token_y : ConfigSetting :: new_default ( None ) ,
@@ -1992,18 +1992,18 @@ impl SenderBuilder {
1992
1992
/// and [`token_y`](SenderBuilder::token_y).
1993
1993
///
1994
1994
/// For HTTP this is part of basic authentication.
1995
- /// Also see [`pass `](SenderBuilder::pass ).
1996
- pub fn user ( mut self , user : & str ) -> Result < Self > {
1997
- self . user
1998
- . set_specified ( "user " , Some ( validate_value ( user . to_string ( ) ) ?) ) ?;
1995
+ /// Also see [`password `](SenderBuilder::password ).
1996
+ pub fn username ( mut self , username : & str ) -> Result < Self > {
1997
+ self . username
1998
+ . set_specified ( "username " , Some ( validate_value ( username . to_string ( ) ) ?) ) ?;
1999
1999
Ok ( self )
2000
2000
}
2001
2001
2002
2002
/// Set the password for basic HTTP authentication.
2003
- /// Also see [`user `](SenderBuilder::user ).
2004
- pub fn pass ( mut self , pass : & str ) -> Result < Self > {
2005
- self . pass
2006
- . set_specified ( "pass " , Some ( validate_value ( pass . to_string ( ) ) ?) ) ?;
2003
+ /// Also see [`username `](SenderBuilder::username ).
2004
+ pub fn password ( mut self , password : & str ) -> Result < Self > {
2005
+ self . password
2006
+ . set_specified ( "password " , Some ( validate_value ( password . to_string ( ) ) ?) ) ?;
2007
2007
Ok ( self )
2008
2008
}
2009
2009
@@ -2295,56 +2295,56 @@ impl SenderBuilder {
2295
2295
fn build_auth ( & self ) -> Result < Option < AuthParams > > {
2296
2296
match (
2297
2297
self . protocol ,
2298
- self . user . deref ( ) ,
2299
- self . pass . deref ( ) ,
2298
+ self . username . deref ( ) ,
2299
+ self . password . deref ( ) ,
2300
2300
self . token . deref ( ) ,
2301
2301
self . token_x . deref ( ) ,
2302
2302
self . token_y . deref ( ) ,
2303
2303
) {
2304
2304
( _, None , None , None , None , None ) => Ok ( None ) ,
2305
2305
(
2306
2306
SenderProtocol :: IlpOverTcp ,
2307
- Some ( user ) ,
2307
+ Some ( username ) ,
2308
2308
None ,
2309
2309
Some ( token) ,
2310
2310
Some ( token_x) ,
2311
2311
Some ( token_y) ,
2312
2312
) => Ok ( Some ( AuthParams :: Ecdsa ( EcdsaAuthParams {
2313
- key_id : user . to_string ( ) ,
2313
+ key_id : username . to_string ( ) ,
2314
2314
priv_key : token. to_string ( ) ,
2315
2315
pub_key_x : token_x. to_string ( ) ,
2316
2316
pub_key_y : token_y. to_string ( ) ,
2317
2317
} ) ) ) ,
2318
- ( SenderProtocol :: IlpOverTcp , Some ( _user ) , Some ( _pass ) , None , None , None ) => {
2318
+ ( SenderProtocol :: IlpOverTcp , Some ( _username ) , Some ( _password ) , None , None , None ) => {
2319
2319
Err ( error:: fmt!( ConfigError ,
2320
2320
r##"The "basic_auth" setting can only be used with the ILP/HTTP protocol."## ,
2321
2321
) )
2322
2322
}
2323
2323
( SenderProtocol :: IlpOverTcp , None , None , Some ( _token) , None , None ) => {
2324
2324
Err ( error:: fmt!( ConfigError , "Token authentication only be used with the ILP/HTTP protocol." ) )
2325
2325
}
2326
- ( SenderProtocol :: IlpOverTcp , _user , None , _token, _token_x, _token_y) => {
2326
+ ( SenderProtocol :: IlpOverTcp , _username , None , _token, _token_x, _token_y) => {
2327
2327
Err ( error:: fmt!( ConfigError ,
2328
- r##"Incomplete ECDSA authentication parameters. Specify either all or none of: "user ", "token", "token_x", "token_y"."## ,
2328
+ r##"Incomplete ECDSA authentication parameters. Specify either all or none of: "username ", "token", "token_x", "token_y"."## ,
2329
2329
) )
2330
2330
}
2331
2331
#[ cfg( feature = "ilp-over-http" ) ]
2332
- ( SenderProtocol :: IlpOverHttp , Some ( user ) , Some ( pass ) , None , None , None ) => {
2332
+ ( SenderProtocol :: IlpOverHttp , Some ( username ) , Some ( password ) , None , None , None ) => {
2333
2333
Ok ( Some ( AuthParams :: Basic ( BasicAuthParams {
2334
- username : user . to_string ( ) ,
2335
- password : pass . to_string ( ) ,
2334
+ username : username . to_string ( ) ,
2335
+ password : password . to_string ( ) ,
2336
2336
} ) ) )
2337
2337
}
2338
2338
#[ cfg( feature = "ilp-over-http" ) ]
2339
- ( SenderProtocol :: IlpOverHttp , Some ( _user ) , None , None , None , None ) => {
2339
+ ( SenderProtocol :: IlpOverHttp , Some ( _username ) , None , None , None , None ) => {
2340
2340
Err ( error:: fmt!( ConfigError ,
2341
- r##"Basic authentication parameter "user " is present, but "pass " is missing."## ,
2341
+ r##"Basic authentication parameter "username " is present, but "password " is missing."## ,
2342
2342
) )
2343
2343
}
2344
2344
#[ cfg( feature = "ilp-over-http" ) ]
2345
- ( SenderProtocol :: IlpOverHttp , None , Some ( _pass ) , None , None , None ) => {
2345
+ ( SenderProtocol :: IlpOverHttp , None , Some ( _password ) , None , None , None ) => {
2346
2346
Err ( error:: fmt!( ConfigError ,
2347
- r##"Basic authentication parameter "pass " is present, but "user " is missing."## ,
2347
+ r##"Basic authentication parameter "password " is present, but "username " is missing."## ,
2348
2348
) )
2349
2349
}
2350
2350
#[ cfg( feature = "ilp-over-http" ) ]
@@ -2356,7 +2356,7 @@ impl SenderBuilder {
2356
2356
#[ cfg( feature = "ilp-over-http" ) ]
2357
2357
(
2358
2358
SenderProtocol :: IlpOverHttp ,
2359
- Some ( _user ) ,
2359
+ Some ( _username ) ,
2360
2360
None ,
2361
2361
Some ( _token) ,
2362
2362
Some ( _token_x) ,
@@ -2365,14 +2365,14 @@ impl SenderBuilder {
2365
2365
Err ( error:: fmt!( ConfigError , "ECDSA authentication is only available with ILP/TCP and not available with ILP/HTTP." ) )
2366
2366
}
2367
2367
#[ cfg( feature = "ilp-over-http" ) ]
2368
- ( SenderProtocol :: IlpOverHttp , _user , _pass , _token, None , None ) => {
2368
+ ( SenderProtocol :: IlpOverHttp , _username , _password , _token, None , None ) => {
2369
2369
Err ( error:: fmt!( ConfigError ,
2370
- r##"Inconsistent HTTP authentication parameters. Specify either "user " and "pass ", or just "token"."## ,
2370
+ r##"Inconsistent HTTP authentication parameters. Specify either "username " and "password ", or just "token"."## ,
2371
2371
) )
2372
2372
}
2373
2373
_ => {
2374
2374
Err ( error:: fmt!( ConfigError ,
2375
- r##"Incomplete authentication parameters. Check "user ", "pass ", "token", "token_x" and "token_y" parameters are set correctly."## ,
2375
+ r##"Incomplete authentication parameters. Check "username ", "password ", "token", "token_x" and "token_y" parameters are set correctly."## ,
2376
2376
) )
2377
2377
}
2378
2378
}
@@ -2634,7 +2634,7 @@ impl Sender {
2634
2634
///
2635
2635
/// The accepted set of keys and values is the same as for the opt's API.
2636
2636
///
2637
- /// E.g. `"http::addr=host:port;user =alice;password=secret;tls_ca=os_roots;"`.
2637
+ /// E.g. `"http::addr=host:port;username =alice;password=secret;tls_ca=os_roots;"`.
2638
2638
///
2639
2639
/// For full list of keys and values, see the [`SenderBuilder`] documentation:
2640
2640
/// The builder API and the configuration string API are equivalent.
0 commit comments