-
Notifications
You must be signed in to change notification settings - Fork 456
refactor(sdk,common): standardize common connection keys among transport protocols #4304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
3a853b4
6e20b9e
4c56ebf
db724e0
b845dac
c4bad24
499a183
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,7 +175,13 @@ impl ConnectionStringOptions for QuicConnectionStringOptions { | |
| return Err(IggyError::InvalidConnectionString); | ||
| } | ||
| }, | ||
| "validate_certificate" => { | ||
| "tls_validate_certificate" | "validate_certificate" => { | ||
| // TODO: Remove the deprecated `validate_certificate` alias after the compatibility release. | ||
| if option_parts[0] == "validate_certificate" { | ||
| tracing::warn!( | ||
| "Connection string option 'validate_certificate' is deprecated; use 'tls_validate_certificate'" | ||
| ); | ||
| } | ||
| validate_certificate = option_parts[1] == "true"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: any value other than an exact also at |
||
| } | ||
| "heartbeat_interval" => { | ||
|
|
@@ -187,7 +193,13 @@ impl ConnectionStringOptions for QuicConnectionStringOptions { | |
| "reconnection_interval" => { | ||
| reconnection_interval = option_parts[1].to_string(); | ||
| } | ||
| "reconnection_reestablish_after" => { | ||
| "reestablish_after" | "reconnection_reestablish_after" => { | ||
| // TODO: Remove the deprecated `reconnection_reestablish_after` alias after the compatibility release. | ||
| if option_parts[0] == "reconnection_reestablish_after" { | ||
| tracing::warn!( | ||
| "Connection string option 'reconnection_reestablish_after' is deprecated; use 'reestablish_after'" | ||
| ); | ||
| } | ||
| reconnection_reestablish_after = option_parts[1].to_string(); | ||
| } | ||
| _ => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ pub struct TcpConnectionStringOptions { | |
| tls_enabled: bool, | ||
| tls_domain: String, | ||
| tls_ca_file: Option<String>, | ||
| tls_validate_certificate: bool, | ||
| reconnection: TcpClientReconnectionConfig, | ||
| heartbeat_interval: NonZeroIggyDuration, | ||
| nodelay: bool, | ||
|
|
@@ -44,6 +45,10 @@ impl TcpConnectionStringOptions { | |
| &self.tls_ca_file | ||
| } | ||
|
|
||
| pub fn tls_validate_certificate(&self) -> bool { | ||
| self.tls_validate_certificate | ||
| } | ||
|
|
||
| pub fn reconnection(&self) -> &TcpClientReconnectionConfig { | ||
| &self.reconnection | ||
| } | ||
|
|
@@ -67,6 +72,7 @@ impl ConnectionStringOptions for TcpConnectionStringOptions { | |
| let mut tls_enabled = false; | ||
| let mut tls_domain = "".to_string(); | ||
| let mut tls_ca_file = None; | ||
| let mut tls_validate_certificate = true; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: this key defaults to |
||
| let mut reconnection_retries = "unlimited".to_owned(); | ||
| let mut reconnection_interval = "1s".to_owned(); | ||
| let mut reestablish_after = "5s".to_owned(); | ||
|
|
@@ -88,7 +94,19 @@ impl ConnectionStringOptions for TcpConnectionStringOptions { | |
| "tls_ca_file" => { | ||
| tls_ca_file = Some(option_parts[1].to_string()); | ||
| } | ||
| "tls_validate_certificate" => { | ||
| tls_validate_certificate = option_parts[1] | ||
| .parse() | ||
| .map_err(|_| IggyError::InvalidConnectionString)?; | ||
| } | ||
| "reconnection_max_retries" => { | ||
| reconnection_retries = option_parts[1].to_string(); | ||
| } | ||
| // TODO: Remove the deprecated `reconnection_retries` alias after the compatibility release. | ||
| "reconnection_retries" => { | ||
| tracing::warn!( | ||
| "Connection string option 'reconnection_retries' is deprecated; use 'reconnection_max_retries'" | ||
| ); | ||
| reconnection_retries = option_parts[1].to_string(); | ||
| } | ||
| "reconnection_interval" => { | ||
|
|
@@ -128,7 +146,7 @@ impl ConnectionStringOptions for TcpConnectionStringOptions { | |
| let heartbeat_interval = NonZeroIggyDuration::from_str(heartbeat_interval.as_str()) | ||
| .map_err(|_| IggyError::InvalidConnectionString)?; | ||
|
|
||
| let connection_string_options = TcpConnectionStringOptions::new( | ||
| let mut connection_string_options = TcpConnectionStringOptions::new( | ||
| tls_enabled, | ||
| tls_domain, | ||
| tls_ca_file, | ||
|
|
@@ -137,6 +155,7 @@ impl ConnectionStringOptions for TcpConnectionStringOptions { | |
| nodelay, | ||
| ); | ||
|
|
||
| connection_string_options.tls_validate_certificate = tls_validate_certificate; | ||
| Ok(connection_string_options) | ||
| } | ||
| } | ||
|
|
@@ -154,6 +173,7 @@ impl TcpConnectionStringOptions { | |
| tls_enabled, | ||
| tls_domain, | ||
| tls_ca_file, | ||
| tls_validate_certificate: true, | ||
| reconnection, | ||
| heartbeat_interval, | ||
| nodelay, | ||
|
|
@@ -167,6 +187,7 @@ impl Default for TcpConnectionStringOptions { | |
| tls_enabled: false, | ||
| tls_domain: "".to_string(), | ||
| tls_ca_file: None, | ||
| tls_validate_certificate: true, | ||
| reconnection: Default::default(), | ||
| heartbeat_interval: NonZeroIggyDuration::from_str("5s").unwrap(), | ||
| nodelay: false, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: the key is
tls_validate_certificatenow, but the quic field and builder still sayvalidate_certificate(quic_client_config.rs:54,quic_client_config_builder.rs:147), while tcp and websocket saytls_validate_certificate. renaming breaks the api, so either note it on #4210 or leave it for a follow-up.