remove structopt dependency
This commit is contained in:
parent
59b9711b62
commit
e22a7e7c8d
114
Cargo.lock
generated
114
Cargo.lock
generated
@ -37,15 +37,6 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-attributes"
|
||||
version = "1.1.2"
|
||||
@ -306,30 +297,29 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.3"
|
||||
version = "3.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"atty",
|
||||
"bitflags",
|
||||
"strsim",
|
||||
"textwrap 0.11.0",
|
||||
"unicode-width",
|
||||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "3.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12e8611f9ae4e068fa3e56931fded356ff745e70987ff76924a6e0ab1c8ef2e3"
|
||||
checksum = "5177fac1ab67102d8989464efd043c6ff44191b1557ec1ddd489b4f7e1447e77"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"clap_derive",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"os_str_bytes",
|
||||
"textwrap 0.14.2",
|
||||
"textwrap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "3.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01d42c94ce7c2252681b5fed4d3627cc807b13dfc033246bd05d5b252399000e"
|
||||
dependencies = [
|
||||
"heck 0.4.0",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -416,7 +406,7 @@ version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"heck 0.3.3",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
@ -679,6 +669,12 @@ dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
@ -958,9 +954,9 @@ checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.35"
|
||||
version = "0.10.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885"
|
||||
checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
@ -978,9 +974,9 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.65"
|
||||
version = "0.9.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a7907e3bfa08bb85105209cdfcb6c63d109f8f6c1ed6ca318fff5c1853fbc1d"
|
||||
checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cc",
|
||||
@ -1264,9 +1260,9 @@ checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49"
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.20.0"
|
||||
version = "0.20.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b5ac6078ca424dc1d3ae2328526a76787fecc7f8011f520e3276730e711fc95"
|
||||
checksum = "4fbfeb8d0ddb84706bc597a5574ab8912817c52a397f819e5b614e2265206921"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
@ -1399,36 +1395,6 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "structopt"
|
||||
version = "0.3.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69b041cdcb67226aca307e6e7be44c8806423d83e018bd662360a93dabce4d71"
|
||||
dependencies = [
|
||||
"clap 2.33.3",
|
||||
"lazy_static",
|
||||
"structopt-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "structopt-derive"
|
||||
version = "0.4.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7813934aecf5f51a54775e00068c237de98489463968231a51746bbbc03f9c10"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.74"
|
||||
@ -1473,15 +1439,6 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
||||
dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.14.2"
|
||||
@ -1648,7 +1605,7 @@ dependencies = [
|
||||
name = "trust-dns"
|
||||
version = "0.21.0-alpha.5"
|
||||
dependencies = [
|
||||
"clap 3.0.7",
|
||||
"clap",
|
||||
"env_logger",
|
||||
"futures",
|
||||
"log",
|
||||
@ -1853,13 +1810,12 @@ dependencies = [
|
||||
name = "trust-dns-util"
|
||||
version = "0.21.0-alpha.5"
|
||||
dependencies = [
|
||||
"clap 3.0.7",
|
||||
"clap",
|
||||
"console",
|
||||
"data-encoding",
|
||||
"env_logger",
|
||||
"log",
|
||||
"openssl",
|
||||
"structopt",
|
||||
"tokio",
|
||||
"trust-dns-client",
|
||||
"trust-dns-proto",
|
||||
@ -1937,12 +1893,6 @@ version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.3"
|
||||
|
@ -307,7 +307,7 @@ impl<'a> From<ArgMatches> for Args {
|
||||
/// `Note`: Tries to avoid panics, in favor of always starting.
|
||||
#[allow(unused_mut)]
|
||||
fn main() {
|
||||
let args = app_from_crate!()
|
||||
let args = command!()
|
||||
.arg(
|
||||
Arg::new(QUIET_ARG)
|
||||
.long(QUIET_ARG)
|
||||
|
@ -55,7 +55,7 @@ name = "resolve"
|
||||
path = "src/resolve.rs"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "3.0", default-features = false, features = ["std", "cargo"] }
|
||||
clap = { version = "3.1", default-features = false, features = ["std", "cargo", "derive"] }
|
||||
console = "0.15.0"
|
||||
data-encoding = "2.2.0"
|
||||
env_logger = { version = "0.9.0", features = ["termcolor", "humantime", "atty"] }
|
||||
@ -64,5 +64,4 @@ trust-dns-proto = { version = "0.21.0-alpha.5", features = ["dnssec-openssl"], p
|
||||
trust-dns-resolver = { version = "0.21.0-alpha.5", features = ["dnssec-openssl"], path = "../crates/resolver" }
|
||||
log = "0.4"
|
||||
openssl = { version = "0.10", features = ["v102", "v110"] }
|
||||
structopt = "0.3"
|
||||
tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] }
|
||||
|
@ -25,7 +25,7 @@ use std::fs::{File, OpenOptions};
|
||||
use std::io::{BufRead, BufReader, Lines, Write};
|
||||
use std::str::FromStr;
|
||||
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
use clap::{Arg, ArgMatches, Command};
|
||||
use data_encoding::BASE64;
|
||||
use log::info;
|
||||
use openssl::bn::BigNum;
|
||||
@ -34,7 +34,7 @@ use openssl::rsa::Rsa;
|
||||
use trust_dns_client::rr::dnssec::Algorithm;
|
||||
|
||||
fn args() -> ArgMatches {
|
||||
App::new("Trust-DNS dnskey-to-pem")
|
||||
Command::new("Trust-DNS dnskey-to-pem")
|
||||
.version(trust_dns_client::version())
|
||||
.author("Benjamin Fry <benjaminfry@me.com>")
|
||||
.about("Converts a dnskey, as generated from BIND's dnssec-keygen, into pem format")
|
||||
|
@ -25,7 +25,7 @@ use std::fs::OpenOptions;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use clap::{app_from_crate, ArgMatches};
|
||||
use clap::{command, ArgMatches};
|
||||
|
||||
use trust_dns_client::rr::dnssec::Algorithm;
|
||||
use trust_dns_proto::rr::dnssec::rdata::DNSSECRData;
|
||||
@ -34,7 +34,7 @@ use trust_dns_proto::rr::record_type::RecordType;
|
||||
use trust_dns_resolver::Resolver;
|
||||
|
||||
fn args() -> ArgMatches {
|
||||
app_from_crate!().bin_name("get-root-ksks").get_matches()
|
||||
command!().bin_name("get-root-ksks").get_matches()
|
||||
}
|
||||
|
||||
/// Run the get_root_ksks program
|
||||
|
@ -23,14 +23,14 @@
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::{BufReader, Read, Write};
|
||||
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
use clap::{Arg, ArgMatches, Command};
|
||||
use log::info;
|
||||
use openssl::pkey::PKey;
|
||||
|
||||
use trust_dns_client::rr::dnssec::{KeyPair, Public};
|
||||
|
||||
fn args() -> ArgMatches {
|
||||
App::new("Trust-DNS pem-to-public-dnskey")
|
||||
Command::new("Trust-DNS pem-to-public-dnskey")
|
||||
.version(trust_dns_client::version())
|
||||
.author("Benjamin Fry <benjaminfry@me.com>")
|
||||
.about(
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
use std::net::{IpAddr, SocketAddr};
|
||||
|
||||
use clap::Parser;
|
||||
use console::style;
|
||||
use structopt::StructOpt;
|
||||
|
||||
use trust_dns_proto::xfer::DnsRequestOptions;
|
||||
use trust_dns_resolver::config::{
|
||||
@ -40,81 +40,81 @@ use trust_dns_resolver::TokioAsyncResolver;
|
||||
/// nameservers are the Google provided ones. The system configured ones can be
|
||||
/// used with the `--system` FLAG. Other nameservers, as many as desired, can
|
||||
/// be configured directly with the `--nameserver` OPTION.
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[structopt(name = "resolve")]
|
||||
#[derive(Debug, Parser)]
|
||||
#[clap(name = "resolve")]
|
||||
struct Opts {
|
||||
/// Name to attempt to resolve, if followed by a '.' then it's a fully-qualified-domain-name.
|
||||
domainname: String,
|
||||
|
||||
/// Type of query to issue, e.g. A, AAAA, NS, etc.
|
||||
#[structopt(short = "t", long = "type", default_value = "A")]
|
||||
#[clap(short = 't', long = "type", default_value = "A")]
|
||||
ty: RecordType,
|
||||
|
||||
/// Happy eye balls lookup, ipv4 and ipv6
|
||||
#[structopt(short = "e", long = "happy", conflicts_with("ty"))]
|
||||
#[clap(short = 'e', long = "happy", conflicts_with("ty"))]
|
||||
happy: bool,
|
||||
|
||||
/// Use system configuration, e.g. /etc/resolv.conf, instead of defaults
|
||||
#[structopt(short = "s", long = "system")]
|
||||
#[clap(short = 's', long = "system")]
|
||||
system: bool,
|
||||
|
||||
/// Use google resolvers, default
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
google: bool,
|
||||
|
||||
/// Use cloudflare resolvers
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
cloudflare: bool,
|
||||
|
||||
/// Use quad9 resolvers
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
quad9: bool,
|
||||
|
||||
/// Specify a nameserver to use, ip and port e.g. 8.8.8.8:53 or \[2001:4860:4860::8888\]:53 (port required)
|
||||
#[structopt(short = "n", long, require_delimiter = true)]
|
||||
#[clap(short = 'n', long, require_value_delimiter = true)]
|
||||
nameserver: Vec<SocketAddr>,
|
||||
|
||||
/// Specify the IP address to connect from.
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
bind: Option<IpAddr>,
|
||||
|
||||
/// Use ipv4 addresses only, default is both ipv4 and ipv6
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
ipv4: bool,
|
||||
|
||||
/// Use ipv6 addresses only, default is both ipv4 and ipv6
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
ipv6: bool,
|
||||
|
||||
/// Use only UDP, default to UDP and TCP
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
udp: bool,
|
||||
|
||||
/// Use only TCP, default to UDP and TCP
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
tcp: bool,
|
||||
|
||||
/// Enable debug and all logging
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
debug: bool,
|
||||
|
||||
/// Enable info + warning + error logging
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
info: bool,
|
||||
|
||||
/// Enable warning + error logging
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
warn: bool,
|
||||
|
||||
/// Enable error logging
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
error: bool,
|
||||
}
|
||||
|
||||
/// Run the resolve program
|
||||
#[tokio::main]
|
||||
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let opts: Opts = Opts::from_args();
|
||||
let opts: Opts = Opts::parse();
|
||||
|
||||
// enable logging early
|
||||
let log_level = if opts.debug {
|
||||
|
Loading…
Reference in New Issue
Block a user