Skip to content

Commit 376f1bc

Browse files
authored
Merge pull request #124 from icann/dev
Release 0.0.22
2 parents 7ad6fc6 + 6bc2331 commit 376f1bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+7148
-3990
lines changed

Cargo.lock

Lines changed: 823 additions & 393 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ members = [
88
resolver = "2"
99

1010
[workspace.package]
11-
version = "0.0.21"
11+
version = "0.0.22"
1212
edition = "2021"
1313
license = "MIT OR Apache-2.0"
1414
repository = "https://github.com/icann/icann-rdap"
@@ -69,9 +69,6 @@ futures-util = "0.3"
6969
# macros to get the git version
7070
git-version = "0.3"
7171

72-
# lazy static initilization
73-
lazy_static = "1.4"
74-
7572
# headers (http headers)
7673
headers = "0.4"
7774

@@ -89,7 +86,7 @@ jsonpath-rust = "=0.5.0"
8986
jsonpath_lib = "0.3.0"
9087

9188
# internationalized domain names for applications
92-
idna = "0.5"
89+
idna = "1.0"
9390

9491
# for use prefixmap
9592
ipnet = { version = "2.9", features = ["json"] }
@@ -151,3 +148,8 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
151148

152149
# url
153150
url = "2.5"
151+
152+
153+
[profile.release]
154+
codegen-units = 1
155+
lto = true

icann-rdap-cli/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ An RDAP Command Line Interface client.
1010

1111
[dependencies]
1212

13-
icann-rdap-client = { version = "0.0.21", path = "../icann-rdap-client" }
14-
icann-rdap-common = { version = "0.0.21", path = "../icann-rdap-common" }
13+
icann-rdap-client = { version = "0.0.22", path = "../icann-rdap-client" }
14+
icann-rdap-common = { version = "0.0.22", path = "../icann-rdap-common" }
1515

1616
anyhow.workspace = true
1717
clap.workspace = true
@@ -20,7 +20,6 @@ const_format.workspace = true
2020
directories.workspace = true
2121
dotenv.workspace = true
2222
hickory-client.workspace = true
23-
lazy_static.workspace = true
2423
minus.workspace = true
2524
pct-str.workspace = true
2625
prefix-trie.workspace = true

icann-rdap-cli/src/bin/rdap-test/error.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use std::process::{ExitCode, Termination};
22

3-
use icann_rdap_cli::rt::exec::TestExecutionError;
4-
use icann_rdap_client::iana::IanaResponseError;
5-
use icann_rdap_client::RdapClientError;
6-
use thiserror::Error;
3+
use {
4+
icann_rdap_cli::rt::exec::TestExecutionError,
5+
icann_rdap_client::{iana::IanaResponseError, RdapClientError},
6+
thiserror::Error,
7+
};
78

89
#[derive(Debug, Error)]
910
pub enum RdapTestError {
@@ -43,31 +44,31 @@ impl Termination for RdapTestError {
4344
fn report(self) -> std::process::ExitCode {
4445
let exit_code: u8 = match self {
4546
// Success
46-
RdapTestError::Success => 0,
47-
RdapTestError::TestsCompletedExecutionErrors => 1,
48-
RdapTestError::TestsCompletedWarningsFound => 2,
49-
RdapTestError::TestsCompletedErrorsFound => 3,
47+
Self::Success => 0,
48+
Self::TestsCompletedExecutionErrors => 1,
49+
Self::TestsCompletedWarningsFound => 2,
50+
Self::TestsCompletedErrorsFound => 3,
5051

5152
// Internal Errors
52-
RdapTestError::Termimad(_) => 10,
53+
Self::Termimad(_) => 10,
5354

5455
// I/O Errors
55-
RdapTestError::IoError(_) => 40,
56-
RdapTestError::TestExecutionError(_) => 40,
56+
Self::IoError(_) => 40,
57+
Self::TestExecutionError(_) => 40,
5758

5859
// RDAP Errors
59-
RdapTestError::Json(_) => 100,
60-
RdapTestError::Iana(_) => 101,
61-
RdapTestError::InvalidBootstrap => 102,
62-
RdapTestError::BootstrapNotFound => 103,
63-
RdapTestError::NoRegistrarFound => 104,
64-
RdapTestError::NoRegistryFound => 105,
60+
Self::Json(_) => 100,
61+
Self::Iana(_) => 101,
62+
Self::InvalidBootstrap => 102,
63+
Self::BootstrapNotFound => 103,
64+
Self::NoRegistrarFound => 104,
65+
Self::NoRegistryFound => 105,
6566

6667
// User Errors
67-
RdapTestError::UnknownOutputType => 200,
68+
Self::UnknownOutputType => 200,
6869

6970
// RDAP Client Errrors
70-
RdapTestError::RdapClient(e) => match e {
71+
Self::RdapClient(e) => match e {
7172
// I/O Errors
7273
RdapClientError::Client(_) => 42,
7374
RdapClientError::IoError(_) => 43,

icann-rdap-cli/src/bin/rdap-test/main.rs

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
use std::io::stdout;
2-
use std::str::FromStr;
3-
4-
use clap::builder::styling::AnsiColor;
5-
use clap::builder::Styles;
6-
use error::RdapTestError;
7-
use icann_rdap_cli::dirs;
8-
use icann_rdap_cli::dirs::fcbs::FileCacheBootstrapStore;
9-
use icann_rdap_cli::rt::exec::execute_tests;
10-
use icann_rdap_cli::rt::exec::ExtensionGroup;
11-
use icann_rdap_cli::rt::exec::TestOptions;
12-
use icann_rdap_cli::rt::results::RunOutcome;
13-
use icann_rdap_cli::rt::results::TestResults;
14-
use icann_rdap_client::http::ClientConfig;
15-
use icann_rdap_client::md::MdOptions;
16-
use icann_rdap_client::rdap::QueryType;
17-
use icann_rdap_common::check::traverse_checks;
18-
use icann_rdap_common::check::CheckClass;
19-
use termimad::crossterm::style::Color::*;
20-
use termimad::Alignment;
21-
use termimad::MadSkin;
22-
use tracing_subscriber::filter::LevelFilter;
23-
24-
use clap::{Parser, ValueEnum};
25-
use icann_rdap_common::VERSION;
1+
use std::{io::stdout, str::FromStr};
2+
3+
#[cfg(debug_assertions)]
4+
use tracing::warn;
5+
use {
6+
clap::builder::{styling::AnsiColor, Styles},
7+
error::RdapTestError,
8+
icann_rdap_cli::{
9+
dirs,
10+
dirs::fcbs::FileCacheBootstrapStore,
11+
rt::{
12+
exec::{execute_tests, ExtensionGroup, TestOptions},
13+
results::{RunOutcome, TestResults},
14+
},
15+
},
16+
icann_rdap_client::{http::ClientConfig, md::MdOptions, rdap::QueryType},
17+
icann_rdap_common::check::{traverse_checks, CheckClass},
18+
termimad::{crossterm::style::Color::*, Alignment, MadSkin},
19+
tracing::info,
20+
tracing_subscriber::filter::LevelFilter,
21+
};
22+
23+
use {
24+
clap::{Parser, ValueEnum},
25+
icann_rdap_common::VERSION,
26+
};
2627

2728
pub mod error;
2829

@@ -350,12 +351,12 @@ enum LogLevel {
350351
impl From<&LogLevel> for LevelFilter {
351352
fn from(log_level: &LogLevel) -> Self {
352353
match log_level {
353-
LogLevel::Off => LevelFilter::OFF,
354-
LogLevel::Error => LevelFilter::ERROR,
355-
LogLevel::Warn => LevelFilter::WARN,
356-
LogLevel::Info => LevelFilter::INFO,
357-
LogLevel::Debug => LevelFilter::DEBUG,
358-
LogLevel::Trace => LevelFilter::TRACE,
354+
LogLevel::Off => Self::OFF,
355+
LogLevel::Error => Self::ERROR,
356+
LogLevel::Warn => Self::WARN,
357+
LogLevel::Info => Self::INFO,
358+
LogLevel::Debug => Self::DEBUG,
359+
LogLevel::Trace => Self::TRACE,
359360
}
360361
}
361362
}
@@ -381,6 +382,11 @@ pub async fn wrapped_main() -> Result<(), RdapTestError> {
381382
.with_writer(std::io::stderr)
382383
.init();
383384

385+
info!("ICANN RDAP {} Testing Tool", VERSION);
386+
387+
#[cfg(debug_assertions)]
388+
warn!("This is a development build of this software.");
389+
384390
let query_type = QueryType::from_str(&cli.query_value)?;
385391

386392
let check_classes = if cli.check_type.is_empty() {

icann-rdap-cli/src/bin/rdap/bootstrap.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
use crate::error::RdapCliError;
2-
use icann_rdap_cli::dirs::fcbs::FileCacheBootstrapStore;
3-
use icann_rdap_client::http::Client;
4-
use icann_rdap_client::iana::BootstrapStore;
5-
use icann_rdap_client::iana::PreferredUrl;
6-
use icann_rdap_client::{
7-
iana::{fetch_bootstrap, qtype_to_bootstrap_url},
8-
rdap::QueryType,
1+
use {
2+
crate::error::RdapCliError,
3+
icann_rdap_cli::dirs::fcbs::FileCacheBootstrapStore,
4+
icann_rdap_client::{
5+
http::Client,
6+
iana::{fetch_bootstrap, qtype_to_bootstrap_url, BootstrapStore, PreferredUrl},
7+
rdap::QueryType,
8+
},
9+
icann_rdap_common::iana::IanaRegistryType,
10+
tracing::debug,
911
};
10-
use icann_rdap_common::iana::IanaRegistryType;
11-
use tracing::debug;
1212

1313
/// Defines the type of bootstrapping to use.
1414
pub(crate) enum BootstrapType {

icann-rdap-cli/src/bin/rdap/error.rs

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use std::process::{ExitCode, Termination};
22

3-
use icann_rdap_client::iana::IanaResponseError;
4-
use icann_rdap_client::RdapClientError;
5-
use minus::MinusError;
6-
use thiserror::Error;
3+
use {
4+
icann_rdap_client::{iana::IanaResponseError, RdapClientError},
5+
minus::MinusError,
6+
thiserror::Error,
7+
tracing::error,
8+
};
79

810
#[derive(Debug, Error)]
911
pub enum RdapCliError {
@@ -35,35 +37,44 @@ pub enum RdapCliError {
3537
NoRegistryFound,
3638
}
3739

38-
impl Termination for RdapCliError {
39-
fn report(self) -> std::process::ExitCode {
40-
let exit_code: u8 = match self {
40+
impl RdapCliError {
41+
pub(crate) fn exit_code(&self) -> u8 {
42+
match self {
4143
// Success
42-
RdapCliError::Success => 0,
44+
Self::Success => 0,
4345

4446
// Internal Errors
45-
RdapCliError::Termimad(_) => 10,
46-
RdapCliError::Minus(_) => 11,
47+
Self::Termimad(_) => 10,
48+
Self::Minus(_) => 11,
4749

4850
// I/O Errors
49-
RdapCliError::IoError(_) => 40,
51+
Self::IoError(_) => 40,
5052

5153
// RDAP Errors
52-
RdapCliError::Json(_) => 100,
53-
RdapCliError::Iana(_) => 101,
54-
RdapCliError::InvalidBootstrap => 102,
55-
RdapCliError::BootstrapNotFound => 103,
56-
RdapCliError::NoRegistrarFound => 104,
57-
RdapCliError::NoRegistryFound => 105,
54+
Self::Json(_) => 100,
55+
Self::Iana(_) => 101,
56+
Self::InvalidBootstrap => 102,
57+
Self::BootstrapNotFound => 103,
58+
Self::NoRegistrarFound => 104,
59+
Self::NoRegistryFound => 105,
5860

5961
// User Errors
60-
RdapCliError::UnknownOutputType => 200,
61-
RdapCliError::ErrorOnChecks => 201,
62+
Self::UnknownOutputType => 200,
63+
Self::ErrorOnChecks => 201,
6264

6365
// RDAP Client Errrors
64-
RdapCliError::RdapClient(e) => match e {
66+
Self::RdapClient(e) => match e {
6567
// I/O Errors
66-
RdapClientError::Client(_) => 42,
68+
RdapClientError::Client(ce) => {
69+
if ce.is_builder() {
70+
match ce.url() {
71+
Some(url) if url.scheme() == "http" => 202,
72+
_ => 42,
73+
}
74+
} else {
75+
42
76+
}
77+
}
6778
RdapClientError::IoError(_) => 43,
6879

6980
// RDAP Server Errors
@@ -85,7 +96,13 @@ impl Termination for RdapCliError {
8596
RdapClientError::Poison => 250,
8697
// _ => 255,
8798
},
88-
};
99+
}
100+
}
101+
}
102+
103+
impl Termination for RdapCliError {
104+
fn report(self) -> std::process::ExitCode {
105+
let exit_code = self.exit_code();
89106
ExitCode::from(exit_code)
90107
}
91108
}

0 commit comments

Comments
 (0)