Skip to content

Commit

Permalink
Merge pull request #105 from AlterionX/rustls-feature
Browse files Browse the repository at this point in the history
Add feature flags for selecting rustls or openssl as the tls implementation.
  • Loading branch information
ivnsch committed Oct 18, 2021
2 parents b49c766 + e052407 commit b727728
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 54 deletions.
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ members = [
]

[dependencies]
algonaut_client = {path = "algonaut_client", version = "0.3.0"}
algonaut_client = {path = "algonaut_client", version = "0.3.0", default-features = false}
algonaut_model = {path = "algonaut_model", version = "0.3.0"}
algonaut_core = {path = "algonaut_core", version = "0.3.0"}
algonaut_crypto = {path = "algonaut_crypto", version = "0.3.0"}
Expand All @@ -34,3 +34,8 @@ tokio = { version = "1.6.0", features = ["rt-multi-thread", "macros"] }
rand = "0.8.3"
getrandom = { version = "0.2.2", features = ["js"] }
data-encoding = "2.3.1"

[features]
default = ["native"]
native = ["algonaut_client/native"]
rustls = ["algonaut_client/rustls"]
7 changes: 6 additions & 1 deletion algonaut_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ algonaut_crypto = {path = "../algonaut_crypto", version = "0.3.0"}
algonaut_encoding = {path = "../algonaut_encoding", version = "0.3.0"}
data-encoding = "2.3.1"
derive_more = "0.99.13"
reqwest = {version = "0.11", features = ["json"]}
reqwest = {version = "0.11", features = ["json"], default-features = false}
serde = {version = "1.0", features = ["derive"]}
serde_json = "1.0.40"
thiserror = "1.0.23"
Expand All @@ -27,3 +27,8 @@ dotenv = "0.15.0"
rand = "0.8.3"
getrandom = { version = "0.2.2", features = ["js"] }
tokio = { version = "1.6.0", features = ["macros"] }

[features]
default = ["native"]
rustls = ["reqwest/rustls-tls"]
native = ["reqwest/native-tls"]
20 changes: 2 additions & 18 deletions src/algod/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub mod v2;
/// Ok(())
/// }
/// ```
#[derive(Default)]
pub struct AlgodBuilder<'a> {
url: Option<&'a str>,
token: Option<&'a str>,
Expand Down Expand Up @@ -76,15 +77,7 @@ impl<'a> AlgodBuilder<'a> {
}
}

impl<'a> Default for AlgodBuilder<'a> {
fn default() -> Self {
AlgodBuilder {
url: None,
token: None,
}
}
}

#[derive(Default)]
pub struct AlgodCustomEndpointBuilder<'a> {
url: Option<&'a str>,
headers: Headers<'a>,
Expand Down Expand Up @@ -122,15 +115,6 @@ impl<'a> AlgodCustomEndpointBuilder<'a> {
}
}

impl<'a> Default for AlgodCustomEndpointBuilder<'a> {
fn default() -> Self {
AlgodCustomEndpointBuilder {
url: None,
headers: vec![],
}
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
17 changes: 2 additions & 15 deletions src/indexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use algonaut_client::{indexer::v2::Client, Headers};
pub mod v2;

/// Indexer is the entry point to the creation of a client for the Algorand's indexer
#[derive(Default)]
pub struct IndexerBuilder<'a> {
url: Option<&'a str>,
}
Expand Down Expand Up @@ -31,12 +32,7 @@ impl<'a> IndexerBuilder<'a> {
}
}

impl<'a> Default for IndexerBuilder<'a> {
fn default() -> Self {
IndexerBuilder { url: None }
}
}

#[derive(Default)]
pub struct IndexerCustomEndpointBuilder<'a> {
url: Option<&'a str>,
headers: Headers<'a>,
Expand Down Expand Up @@ -71,15 +67,6 @@ impl<'a> IndexerCustomEndpointBuilder<'a> {
}
}

impl<'a> Default for IndexerCustomEndpointBuilder<'a> {
fn default() -> Self {
IndexerCustomEndpointBuilder {
url: None,
headers: vec![],
}
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
21 changes: 2 additions & 19 deletions src/kmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub mod v1;
/// Ok(())
/// }
/// ```
#[derive(Default)]
pub struct KmdBuilder<'a> {
url: Option<&'a str>,
token: Option<&'a str>,
Expand Down Expand Up @@ -65,16 +66,7 @@ impl<'a> KmdBuilder<'a> {
}
}

impl<'a> Default for KmdBuilder<'a> {
fn default() -> Self {
KmdBuilder {
url: None,
token: None,
headers: vec![],
}
}
}

#[derive(Default)]
pub struct KmdCustomEndpointBuilder<'a> {
url: Option<&'a str>,
headers: Headers<'a>,
Expand Down Expand Up @@ -109,15 +101,6 @@ impl<'a> KmdCustomEndpointBuilder<'a> {
}
}

impl<'a> Default for KmdCustomEndpointBuilder<'a> {
fn default() -> Self {
KmdCustomEndpointBuilder {
url: None,
headers: vec![],
}
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit b727728

Please sign in to comment.