diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 08487d5..1c5f6bc 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -4,8 +4,6 @@ on: push: branches: - release - - master - - release tags: - 'latest' jobs: @@ -13,19 +11,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 - - name: openssl dependency + uses: actions/checkout@v3 + - name: Install OpenSSL dependency run: | sudo apt-get install libssl-dev - - name: Updating cargo - run: | - cargo update + - name: Update Cargo + run: cargo update - name: Build run: | cargo build --target=x86_64-unknown-linux-gnu --release - mkdir out + mkdir -p out mv -v target/x86_64-unknown-linux-gnu/release/doge out/doge_linux_64bit - - name: Upload to artifact + - name: Upload to Artifact uses: actions/upload-artifact@v3 with: name: binary_linux @@ -34,10 +31,9 @@ jobs: runs-on: macos-latest steps: - name: Checkout - uses: actions/checkout@v4 - - name: Updating cargo - run: | - cargo update + uses: actions/checkout@v3 + - name: Update Cargo + run: cargo update - name: Setup Dependencies run: | rustup target add aarch64-apple-darwin @@ -46,10 +42,10 @@ jobs: run: | cargo build --target=aarch64-apple-darwin --release cargo build --target=x86_64-apple-darwin --release - mkdir out + mkdir -p out mv -v target/aarch64-apple-darwin/release/doge out/doge_darwin_arm64 mv -v target/x86_64-apple-darwin/release/doge out/doge_darwin_x86_64 - - name: Upload to artifact + - name: Upload to Artifact uses: actions/upload-artifact@v3 with: name: binary_macos @@ -58,38 +54,42 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v4 - - name: Setup rust - run: | - rustup target add aarch64-pc-windows-msvc + uses: actions/checkout@v3 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Setup Windows Dependencies + run: rustup target add aarch64-pc-windows-msvc - name: Build run: | cargo build --release --target x86_64-pc-windows-msvc - mkdir out + mkdir -p out move target\x86_64-pc-windows-msvc\release\doge.exe out\doge_windows_x86_64.exe - - name: Upload to artifact + - name: Upload to Artifact uses: actions/upload-artifact@v3 with: name: binary_windows path: ./out/* release: - runs-on: ubuntu-latest - needs: - - build-linux - - build-windows - - build-macos - steps: - - name: Download Artifact - uses: actions/download-artifact@v3 - with: - path: ./artifacts - - name: organize files - run: | - tree artifacts - mkdir out - mv -v artifacts/**/doge_* out/ - - name: Release - if: startsWith(github.ref, 'refs/tags/') - uses: softprops/action-gh-release@v1 - with: - files: ./out/doge_* + runs-on: ubuntu-latest + needs: + - build-linux + - build-windows + - build-macos + steps: + - name: Download Artifact + uses: actions/download-artifact@v3 + with: + path: ./artifacts + - name: Organize Files + run: | + mkdir -p out + mv -v artifacts/**/doge_* out/ + - name: Release + if: ${{ startsWith(github.ref, 'refs/tags/') }} + uses: softprops/action-gh-release@v1 + with: + files: ./out/doge_* diff --git a/Cargo.lock b/Cargo.lock index 7f1b6ad..59092d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -209,9 +209,9 @@ dependencies = [ [[package]] name = "doge_transport" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d86321702916d28a95a1137291e5f7de57e496d94d7f53b306469d802b62c66" +checksum = "fa9645f94826864bb8a0bb78291dee9b6f01ed7ad011123539b3fe203471424d" dependencies = [ "cfg-if", "doge_dns", @@ -394,9 +394,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "matches" @@ -458,9 +458,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ "bitflags", "cfg-if", @@ -499,9 +499,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -530,9 +530,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "pretty_assertions" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" dependencies = [ "diff", "yansi", @@ -1124,9 +1124,9 @@ dependencies = [ [[package]] name = "yansi" -version = "0.5.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "zeroize" diff --git a/Cargo.toml b/Cargo.toml index 424d083..33e8468 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ exclude = [ homepage = "https://dns.lookup.dog/" license = "MIT" -version = "0.2.7" +version = "0.2.8" [[bin]] name = "doge" @@ -41,7 +41,7 @@ panic = "abort" # dns stuff doge_dns = "1.0.2" -doge_transport = "0.2.5" +doge_transport = "0.2.6" # command-line ansi_term = "0.12" diff --git a/README.md b/README.md index d5ce498..f37a92f 100644 --- a/README.md +++ b/README.md @@ -1,159 +1,116 @@ -
-

doge

- -doge is a fork of [dog](https://github.com/ogham/dog). - - - - - Say thanks! - +

DOGE

+ +

+ license + Say thanks! + last-commit + repo-top-language + repo-language-count +

+

+ YAML + PowerShell + Docker + GitHub%20Actions + JSON + Rust +

+
+ + A screenshot of dog making a DNS request + +
+ +
+

Doge can look up!

+

doge is a command-line DNS client, like dig forked from the amazing work done here. It has colourful output, understands normal command-line argument syntax, supports the DNS-over-TLS and DNS-over-HTTPS protocols, and can emit JSON. I believe this is an amazing project and should be improved on.

+
+ +
+

Examples

+
+    doge example.net                          Query a domain using default settings
+    doge example.net MX                       ...looking up MX records instead
+    doge example.net MX @1.1.1.1              ...using a specific nameserver instead
+    doge example.net MX @1.1.1.1 -T           ...using TCP rather than UDP
+    doge exapple.net MX @1.1.1.1 -p 69        ...using a nonstandard port
+    doge -q example.net -t MX -n 1.1.1.1 -T   As above, but using explicit arguments
+  
+ +

Command-line options

+
+

Query options

+
+      <arguments>              Human-readable host names, nameservers, types, or classes
+      -q, --query=HOST             Host name or domain name to query
+      -t, --type=TYPE              Type of the DNS record being queried (A, MX, NS...)
+      -n, --nameserver=ADDR        Address of the nameserver to send packets to
+      -p, --port=PORT                Port options for sending queries on nonstandard ports
+      --class=CLASS                 Network class of the DNS record being queried (IN, CH, HS)
+    
+
+ +
+

Sending options

+
+      --edns=SETTING           Whether to OPT in to EDNS (disable, hide, show)
+      --txid=NUMBER            Set the transaction ID to a specific value
+      -Z=TWEAKS                Set uncommon protocol-level tweaks
+    
+
+ +
+

Protocol options

+
+      -U, --udp                Use the DNS protocol over UDP
+      -T, --tcp                Use the DNS protocol over TCP
+      -S, --tls                Use the DNS-over-TLS protocol
+      -H, --https              Use the DNS-over-HTTPS protocol
+    
+
+ +
+

Output options

+
+      -1, --short              Short mode: display nothing but the first result
+      -J, --json               Display the output as JSON
+      --color, --colour=WHEN   When to colourise the output (always, automatic, never)
+      --seconds                Do not format durations, display them as seconds
+      --time                   Print how long the response took to arrive
+    
+
-![A screenshot of dog making a DNS request](doge-screenshot.jpg) - ---- - -Doge _can_ look up! - -**doge** is a command-line DNS client, like `dig` forked from the amazing work done [here](https://github.com/ogham/dog). -It has colourful output, understands normal command-line argument syntax, supports the DNS-over-TLS and DNS-over-HTTPS protocols, and can emit JSON. I belive this is an amazing project and should be improved on. - -## Examples - - doge example.net Query a domain using default settings - doge example.net MX ...looking up MX records instead - doge example.net MX @1.1.1.1 ...using a specific nameserver instead - doge example.net MX @1.1.1.1 -T ...using TCP rather than UDP - doge exapple.net MX @1.1.1.1 -p 53 ...using a nonstandart port - doge -q example.net -t MX -n 1.1.1.1 -T As above, but using explicit arguments - ---- - -## Command-line options - -### Query options - - Human-readable host names, nameservers, types, or classes - -q, --query=HOST Host name or domain name to query - -t, --type=TYPE Type of the DNS record being queried (A, MX, NS...) - -n, --nameserver=ADDR Address of the nameserver to send packets to - -p, --port=PORT Port options for sending queries on nonstandart ports - --class=CLASS Network class of the DNS record being queried (IN, CH, HS) - -### Sending options - - --edns=SETTING Whether to OPT in to EDNS (disable, hide, show) - --txid=NUMBER Set the transaction ID to a specific value - -Z=TWEAKS Set uncommon protocol-level tweaks - -### Protocol options - -U, --udp Use the DNS protocol over UDP - -T, --tcp Use the DNS protocol over TCP - -S, --tls Use the DNS-over-TLS protocol - -H, --https Use the DNS-over-HTTPS protocol + -### Output options - - -1, --short Short mode: display nothing but the first result - -J, --json Display the output as JSON - --color, --colour=WHEN When to colourise the output (always, automatic, never) - --seconds Do not format durations, display them as seconds - --time Print how long the response took to arrive - - ---- - -## Installation - -Currently: - To install dog, you can download a pre-compiled binary, or you can compile it from source. You _**may**_ be able to install dog using your OS’s package manager, depending on your platform. - -Issues: - I am not a rust expert at all, Honestly I'm the opposite, just learning codding. I used [`dog`](https://github.com/ogham/dog) on my arch system and a few random *nix Laptops that I perpetually fix and break . As such part of this progect will be outside of my skill set or ability to work on currently. - For **Windows** I don't intende on installing windows 11 anytime soon, So I most likely won't be adding new windows features - For **Macos** Till i can afford to waste money on a mac, the workflow for building release packages is the only support macos is going to get - For **Docker**, This is magic as far as I'm concerned. While I learn the spells to use it in a meaningful way expect things to be broken - - If any of these are things you want to see make a PR and I'll read and merge it, Be on the lookout for some potentially dumb questions from me. - -### Packages - - They exist now !!! - - $ cargo install dns-doge - $ yay -S dns-doge +

Installation

+
+

Current and Upcoming packages

+
+        Cargo: cargo install dns-doge
+        ArchLinux: yay -S dns_doge
+        Ubuntu/Debian: Comming Soon
+        RHEL/Fedora/Cenos: Publishing rpm
+    
- - - -### Downloads - -Binary downloads of doge are available from [the releases section on GitHub](https://github.com/Dj-Codeman/doge/releases/) for 64-bit Windows, macOS, and Linux targets. They contain the compiled executable, the manual page, and shell completions. - - -### Compilation - -doge is written in [Rust](https://www.rust-lang.org). -I working on rustc version [1.76.0](https://blog.rust-lang.org/2024/02/08/Rust-1.76.0.html) you should be running this version or newer. -The recommended way to install Rust for development is from the [official download page](https://www.rust-lang.org/tools/install), using rustup. - -To build, download the source code and run: - - $ cargo build - $ cargo test - - -- If you are compiling a copy for yourself, be sure to run `cargo build --release` or `make build-release` to benefit from release-mode optimisations. -Copy the resulting binary, which will be in the `target/release` directory, into a folder in your `$PATH`. -`/usr/local/bin` is usually a good choice. - -- To compile and install the manual pages, you will need [pandoc](https://pandoc.org/). -The `make man` command will compile the Markdown into manual pages, which it will place in the `target/man` directory. -To use them, copy them into a directory that `man` will read. -`/usr/local/share/man` is usually a good choice. - - -### Container image - -To build the container image of doge, you can use Docker, Podman or Kaniko. Here an example using Docker: - - $ docker build -t doge . - -You can then run it using the following command: - - $ docker run -it --rm doge - -To run dog directly, you can then define the following alias: - - $ alias doge="docker run -it --rm doge" - - -### Feature toggles - -doge has three Cargo features that can be switched off to remove functionality. -While doing so makes doge less useful, it results in a smaller binary that takes less time to build. - -There are three feature toggles available, all of which are active by default: - -- `with_idna`, which enables [IDNA](https://en.wikipedia.org/wiki/Internationalized_domain_name) processing -- `with_tls`, which enables DNS-over-TLS -- `with_https`, which enables DNS-over-HTTPS (requires `with_tls`) - -Use `cargo` to build a binary that uses feature toggles. For example, to disable TLS and HTTPS support but keep IDNA support enabled, you can run: - - $ cargo build --no-default-features --features=with_idna - -The list of features that have been disabled can be checked at runtime as part of the `--version` string. - - ---- - -## Documentation - -For documentation on how to use doge, see the dog website: -Eventually I will make a new one \ No newline at end of file +

Docker/Podman

+

To build the container image of doge, you can use Docker or Podman. Here an example using Docker:

+ $ docker build -t doge . +

You can then run it using the following command:

+ $ docker run -it --rm doge + +

To run doge directly, you can then define the following alias:

+ + $ alias doge="docker run -it --rm doge" + +

Notes

+

I am not a Rust expert at all, Honestly I'm the opposite, just learning coding. I used dog on my Arch system and a few random *nix Laptops that I perpetually fix and break. As such parts of maintaining and improving this project + will be outside of my understanding. Learning packaging, docker stuff and CI/CD. I'm too broke for a mac book, and currently refuse to + install windows 10/11, Small fixes and improvements I'll try to fix timely but major things especially on my non target machines might + take awhile - forever to fix ( please drop a PR ) in those cases :).

+ +

Website

+

I will make a website at some point... for the time being nothing to drastic has changed from the dog website +

+
diff --git a/completions/doge.bash b/completions/doge.bash index 55c803a..76faf69 100644 --- a/completions/doge.bash +++ b/completions/doge.bash @@ -45,4 +45,4 @@ _doge() ;; esac } && -complete -o bashdefault -F _dog dog +complete -o bashdefault -F _doge doge diff --git a/man/doge.1.md b/man/doge.1.md index 6506907..5c13c5d 100644 --- a/man/doge.1.md +++ b/man/doge.1.md @@ -1,4 +1,4 @@ -% doge(1) v0.1.1 +% doge(1) v0.2.7 diff --git a/src/colours.rs b/src/colours.rs index 9535722..74e6d52 100644 --- a/src/colours.rs +++ b/src/colours.rs @@ -5,6 +5,7 @@ use ansi_term::Color::*; /// The **colours** are used to paint the input. +#[allow(dead_code)] #[derive(Debug, Default)] pub struct Colours { pub qname: Style, diff --git a/src/main.rs b/src/main.rs index b7e7480..7203f9e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -177,11 +177,12 @@ fn run(Options { requests, format, measure_time }: Options) -> i32 { /// Checks whether the options contain parameters that will cause dog to fail /// because the feature is disabled by exiting if so. #[allow(unused)] +#[allow(unexpected_cfgs)] fn disabled_feature_check(options: &Options) { use std::process::exit; use crate::connect::TransportType; - #[cfg(all(not(feature = "with_tls"), not(feature = "with_rustls_tls")))] + #[cfg(all(not(feature = "with_tls"), not(feature = "with_rustls")))] if options.requests.inputs.transport_types.contains(&TransportType::TLS) { eprintln!("doge: Cannot use '--tls': This version of dog has been compiled without TLS support"); exit(exits::OPTIONS_ERROR); diff --git a/src/options.rs b/src/options.rs index ad3764a..48acd3a 100644 --- a/src/options.rs +++ b/src/options.rs @@ -247,6 +247,7 @@ impl Inputs { fn load_fallbacks(&mut self) { if self.record_types.is_empty() { self.record_types.push(RecordType::A); + self.record_types.push(RecordType::AAAA); } if self.classes.is_empty() { diff --git a/src/resolve.rs b/src/resolve.rs index e5b35bf..4222f7a 100644 --- a/src/resolve.rs +++ b/src/resolve.rs @@ -89,6 +89,7 @@ impl Resolver { fn system_nameservers() -> Result { use std::fs::File; use std::io::{BufRead, BufReader}; + use std::net::IpAddr; if cfg!(test) { panic!("system_nameservers() called from test code"); @@ -103,7 +104,7 @@ fn system_nameservers() -> Result { let line = line?; if let Some(nameserver_str) = line.strip_prefix("nameserver ") { - let ip: Result = nameserver_str.parse(); + let ip: Result = nameserver_str.parse(); // TODO: This will need to be changed for IPv6 support. match ip {