Skip to content

Commit

Permalink
release: 0.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Oct 17, 2024
2 parents db4428e + f936d38 commit e91f217
Show file tree
Hide file tree
Showing 12 changed files with 511 additions and 440 deletions.
44 changes: 22 additions & 22 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# Project Dependencies
Package: adbyss
Version: 0.13.0
Generated: 2024-09-05 20:03:14 UTC
Version: 0.13.1
Generated: 2024-10-17 19:40:20 UTC

| Package | Version | Author(s) | License |
| ---- | ---- | ---- | ---- |
| [adbyss_core](https://github.com/Blobfolio/adbyss) | 0.13.0 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [adbyss_psl](https://github.com/Blobfolio/adbyss) | 0.13.0 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [adbyss_core](https://github.com/Blobfolio/adbyss) | 0.13.1 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [adbyss_psl](https://github.com/Blobfolio/adbyss) | 0.13.1 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [ahash](https://github.com/tkaitchuck/ahash) | 0.8.11 | [Tom Kaitchuck](mailto:[email protected]) | Apache-2.0 or MIT |
| [aho-corasick](https://github.com/BurntSushi/aho-corasick) | 1.1.3 | [Andrew Gallant](mailto:[email protected]) | MIT or Unlicense |
| [anyhow](https://github.com/dtolnay/anyhow) | 1.0.86 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [argyle](https://github.com/Blobfolio/argyle) | 0.8.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [anyhow](https://github.com/dtolnay/anyhow) | 1.0.89 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [argyle](https://github.com/Blobfolio/argyle) | 0.10.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [cfg-if](https://github.com/alexcrichton/cfg-if) | 1.0.0 | [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
| [crossbeam-deque](https://github.com/crossbeam-rs/crossbeam) | 0.8.5 | | Apache-2.0 or MIT |
| [crossbeam-epoch](https://github.com/crossbeam-rs/crossbeam) | 0.9.18 | | Apache-2.0 or MIT |
| [crossbeam-utils](https://github.com/crossbeam-rs/crossbeam) | 0.8.20 | | Apache-2.0 or MIT |
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.7.3 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.7.4 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [displaydoc](https://github.com/yaahc/displaydoc) | 0.2.5 | [Jane Lusby](mailto:[email protected]) | Apache-2.0 or MIT |
| [either](https://github.com/rayon-rs/either) | 1.13.0 | bluss | Apache-2.0 or MIT |
| [equivalent](https://github.com/cuviper/equivalent) | 1.0.1 | | Apache-2.0 or MIT |
| [fastrand](https://github.com/smol-rs/fastrand) | 2.1.1 | [Stjepan Glavina](mailto:[email protected]) | Apache-2.0 or MIT |
| [fyi_msg](https://github.com/Blobfolio/fyi) | 0.14.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [fyi_msg](https://github.com/Blobfolio/fyi) | 1.1.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [getrandom](https://github.com/rust-random/getrandom) | 0.2.15 | The Rand Project Developers | Apache-2.0 or MIT |
| [hashbrown](https://github.com/rust-lang/hashbrown) | 0.14.5 | [Amanieu d'Antras](mailto:[email protected]) | Apache-2.0 or MIT |
| [hashbrown](https://github.com/rust-lang/hashbrown) | 0.15.0 | [Amanieu d'Antras](mailto:[email protected]) | Apache-2.0 or MIT |
| [icu_collections](https://github.com/unicode-org/icu4x) | 1.5.0 | The ICU4X Project Developers | Unicode-3.0 |
| [icu_locid](https://github.com/unicode-org/icu4x) | 1.5.0 | The ICU4X Project Developers | Unicode-3.0 |
| [icu_locid_transform](https://github.com/unicode-org/icu4x) | 1.5.0 | The ICU4X Project Developers | Unicode-3.0 |
Expand All @@ -34,40 +34,40 @@
| [icu_provider](https://github.com/unicode-org/icu4x) | 1.5.0 | The ICU4X Project Developers | Unicode-3.0 |
| [icu_provider_macros](https://github.com/unicode-org/icu4x) | 1.5.0 | The ICU4X Project Developers | Unicode-3.0 |
| [idna](https://github.com/servo/rust-url/) | 1.0.2 | The rust-url developers | Apache-2.0 or MIT |
| [indexmap](https://github.com/indexmap-rs/indexmap) | 2.5.0 | | Apache-2.0 or MIT |
| [indexmap](https://github.com/indexmap-rs/indexmap) | 2.6.0 | | Apache-2.0 or MIT |
| [itoa](https://github.com/dtolnay/itoa) | 1.0.11 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [libc](https://github.com/rust-lang/libc) | 0.2.158 | The Rust Project Developers | Apache-2.0 or MIT |
| [libc](https://github.com/rust-lang/libc) | 0.2.161 | The Rust Project Developers | Apache-2.0 or MIT |
| [libyml](https://github.com/sebastienrousseau/libyml) | 0.0.5 | LibYML Contributors | MIT |
| [litemap](https://github.com/unicode-org/icu4x) | 0.7.3 | The ICU4X Project Developers | Unicode-3.0 |
| [log](https://github.com/rust-lang/log) | 0.4.22 | The Rust Project Developers | Apache-2.0 or MIT |
| [memchr](https://github.com/BurntSushi/memchr) | 2.7.4 | [Andrew Gallant](mailto:[email protected]) and bluss | MIT or Unlicense |
| [minreq](https://github.com/neonmoe/minreq) | 2.12.0 | [Jens Pitkanen](mailto:[email protected]) | ISC |
| [once_cell](https://github.com/matklad/once_cell) | 1.19.0 | [Aleksey Kladov](mailto:[email protected]) | Apache-2.0 or MIT |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | 1.0.86 | [David Tolnay](mailto:[email protected]) and [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
| [once_cell](https://github.com/matklad/once_cell) | 1.20.2 | [Aleksey Kladov](mailto:[email protected]) | Apache-2.0 or MIT |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | 1.0.88 | [David Tolnay](mailto:[email protected]) and [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
| [quote](https://github.com/dtolnay/quote) | 1.0.37 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [rayon](https://github.com/rayon-rs/rayon) | 1.10.0 | [Niko Matsakis](mailto:[email protected]) and [Josh Stone](mailto:[email protected]) | Apache-2.0 or MIT |
| [rayon-core](https://github.com/rayon-rs/rayon) | 1.12.1 | [Niko Matsakis](mailto:[email protected]) and [Josh Stone](mailto:[email protected]) | Apache-2.0 or MIT |
| [regex](https://github.com/rust-lang/regex) | 1.10.6 | The Rust Project Developers and [Andrew Gallant](mailto:[email protected]) | Apache-2.0 or MIT |
| [regex-automata](https://github.com/rust-lang/regex/tree/master/regex-automata) | 0.4.7 | The Rust Project Developers and [Andrew Gallant](mailto:[email protected]) | Apache-2.0 or MIT |
| [regex-syntax](https://github.com/rust-lang/regex/tree/master/regex-syntax) | 0.8.4 | The Rust Project Developers and [Andrew Gallant](mailto:[email protected]) | Apache-2.0 or MIT |
| [regex](https://github.com/rust-lang/regex) | 1.11.0 | The Rust Project Developers and [Andrew Gallant](mailto:[email protected]) | Apache-2.0 or MIT |
| [regex-automata](https://github.com/rust-lang/regex/tree/master/regex-automata) | 0.4.8 | The Rust Project Developers and [Andrew Gallant](mailto:[email protected]) | Apache-2.0 or MIT |
| [regex-syntax](https://github.com/rust-lang/regex/tree/master/regex-syntax) | 0.8.5 | The Rust Project Developers and [Andrew Gallant](mailto:[email protected]) | Apache-2.0 or MIT |
| [ring](https://github.com/briansmith/ring) | 0.17.8 | [Brian Smith](mailto:[email protected]) | |
| [rustls](https://github.com/rustls/rustls) | 0.21.12 | | Apache-2.0, ISC, or MIT |
| [rustls-webpki](https://github.com/rustls/webpki) | 0.101.7 | | ISC |
| [ryu](https://github.com/dtolnay/ryu) | 1.0.18 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or BSL-1.0 |
| [sct](https://github.com/rustls/sct.rs) | 0.7.1 | [Joseph Birr-Pixton](mailto:[email protected]) | Apache-2.0, ISC, or MIT |
| [serde](https://github.com/serde-rs/serde) | 1.0.209 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [serde_derive](https://github.com/serde-rs/serde) | 1.0.209 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [serde](https://github.com/serde-rs/serde) | 1.0.210 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [serde_derive](https://github.com/serde-rs/serde) | 1.0.210 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [serde_yml](https://github.com/sebastienrousseau/serde_yml) | 0.0.12 | Serde YML Contributors | Apache-2.0 or MIT |
| [smallvec](https://github.com/servo/rust-smallvec) | 1.13.2 | The Servo Project Developers | Apache-2.0 or MIT |
| [stable_deref_trait](https://github.com/storyyeller/stable_deref_trait) | 1.2.0 | [Robert Grosse](mailto:[email protected]) | Apache-2.0 or MIT |
| [syn](https://github.com/dtolnay/syn) | 2.0.77 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [syn](https://github.com/dtolnay/syn) | 2.0.79 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [synstructure](https://github.com/mystor/synstructure) | 0.13.1 | [Nika Layzell](mailto:[email protected]) | MIT |
| [tempfile](https://github.com/Stebalien/tempfile) | 3.12.0 | [Steven Allen](mailto:[email protected]), The Rust Project Developers, [Ashley Mannix](mailto:[email protected]), and [Jason White](mailto:[email protected]) | Apache-2.0 or MIT |
| [tempfile](https://github.com/Stebalien/tempfile) | 3.13.0 | [Steven Allen](mailto:[email protected]), The Rust Project Developers, [Ashley Mannix](mailto:[email protected]), and [Jason White](mailto:[email protected]) | Apache-2.0 or MIT |
| [tinystr](https://github.com/unicode-org/icu4x) | 0.7.6 | The ICU4X Project Developers | Unicode-3.0 |
| [trimothy](https://github.com/Blobfolio/trimothy) | 0.3.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [unicode-ident](https://github.com/dtolnay/unicode-ident) | 1.0.12 | [David Tolnay](mailto:[email protected]) | Apache-2.0 AND Unicode-DFS-2016 or MIT |
| [unicode-ident](https://github.com/dtolnay/unicode-ident) | 1.0.13 | [David Tolnay](mailto:[email protected]) | Apache-2.0 AND Unicode-DFS-2016 or MIT |
| [untrusted](https://github.com/briansmith/untrusted) | 0.9.0 | [Brian Smith](mailto:[email protected]) | ISC |
| [utc2k](https://github.com/Blobfolio/utc2k) | 0.9.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [utc2k](https://github.com/Blobfolio/utc2k) | 0.10.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [utf16_iter](https://github.com/hsivonen/utf16_iter) | 1.0.5 | [Henri Sivonen](mailto:[email protected]) | Apache-2.0 or MIT |
| [utf8_iter](https://github.com/hsivonen/utf8_iter) | 1.0.4 | [Henri Sivonen](mailto:[email protected]) | Apache-2.0 or MIT |
| [webpki-roots](https://github.com/rustls/webpki-roots) | 0.25.4 | | MPL-2.0 |
Expand Down
9 changes: 6 additions & 3 deletions adbyss/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "adbyss"
version = "0.13.0"
version = "0.13.1"
license = "WTFPL"
authors = ["Josh Stoik <[email protected]>"]
edition = "2021"
Expand Down Expand Up @@ -89,9 +89,9 @@ items = [
]

[dependencies]
argyle = "0.8.*"
argyle = "0.10.*"
dactyl = "0.7.*"
fyi_msg = "0.14.*"
fyi_msg = "1.1.*"
libc = "0.2.*"
serde_yml = "=0.0.12"

Expand All @@ -101,3 +101,6 @@ path = "../adbyss_core"
[dependencies.serde]
version = "1.0.*"
features = [ "derive" ]

[build-dependencies]
argyle = "0.10.*"
34 changes: 34 additions & 0 deletions adbyss/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*!
# Adbyss: Build
*/

use argyle::KeyWordsBuilder;
use std::path::PathBuf;



/// # Set Up CLI Arguments.
pub fn main() {
let mut builder = KeyWordsBuilder::default();
builder.push_keys([
"--disable",
"-h", "--help",
"-q", "--quiet",
"--show",
"--stdout",
"--systemd",
"-V", "--version",
"-y", "--yes",
]);
builder.push_keys_with_values(["-c", "--config"]);
builder.save(out_path("argyle.rs"));
}

/// # Output Path.
///
/// Append the sub-path to OUT_DIR and return it.
fn out_path(stub: &str) -> PathBuf {
std::fs::canonicalize(std::env::var("OUT_DIR").expect("Missing OUT_DIR."))
.expect("Missing OUT_DIR.")
.join(stub)
}
100 changes: 59 additions & 41 deletions adbyss/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,7 @@ use adbyss_core::{
AdbyssError,
FLAG_Y,
};
use argyle::{
Argue,
ArgyleError,
FLAG_HELP,
FLAG_VERSION,
};
use argyle::Argument;
use fyi_msg::Msg;
use dactyl::NiceU64;
use settings::Settings;
Expand All @@ -76,18 +71,33 @@ use std::{



/// # CLI: Disable Shitlist.
const CLI_DISABLE: u8 = 0b0000_0001;

/// # CLI: Quiet.
const CLI_QUIET: u8 = 0b0000_0010;

/// # CLI: Show Only.
const CLI_SHOW: u8 = 0b0000_0100;

/// # CLI: To STDOUT.
const CLI_STDOUT: u8 = 0b0000_1000;

/// # CLI: Systemd Mode.
const CLI_SYSTEMD: u8 = 0b0001_0000;

/// # CLI: Yes to Prompts.
const CLI_YES: u8 = 0b0010_0000;


/// Main.
fn main() {
match _main() {
Err(AdbyssError::Argue(ArgyleError::WantsVersion)) => {
Err(AdbyssError::PrintVersion) => {
println!(concat!("Adbyss v", env!("CARGO_PKG_VERSION")));
},
Err(AdbyssError::Argue(ArgyleError::WantsHelp)) => {
helper();
},
Err(e) => {
Msg::error(e.to_string()).die(1);
},
Err(AdbyssError::PrintHelp) => { helper(); },
Err(e) => { Msg::error(e.to_string()).die(1); },
Ok(()) => {},
}
}
Expand All @@ -98,33 +108,43 @@ fn _main() -> Result<(), AdbyssError> {
// We need root!
require_root()?;

// Parse CLI arguments.
let args = Argue::new(FLAG_VERSION | FLAG_HELP)?;

// Check for invalid CLI options.
if let Some(boo) = args.check_keys(
&[
b"--disable",
b"--quiet",
b"--show",
b"--stdout",
b"--systemd",
b"--yes",
b"-q",
b"-y",
],
&[b"--config", b"-c"],
) {
return Err(AdbyssError::InvalidCli(String::from_utf8_lossy(boo).into()));
// Set up the parser.
let args = argyle::args().with_keywords(
include!(concat!(env!("OUT_DIR"), "/argyle.rs"))
);

// See what we've got!
let mut config = None;
let mut flags = 0_u8;
for arg in args {
match arg {
Argument::Key("--disable") => { flags |= CLI_DISABLE; },
Argument::Key("-q" | "--quiet") => { flags |= CLI_QUIET; },
Argument::Key("--show") => { flags |= CLI_SHOW; },
Argument::Key("--stdout") => { flags |= CLI_STDOUT; },
Argument::Key("--systemd") => { flags |= CLI_SYSTEMD; },
Argument::Key("-y" | "--yes") => { flags |= CLI_YES; },

Argument::Key("-h" | "--help") => return Err(AdbyssError::PrintHelp),
Argument::Key("-V" | "--version") => return Err(AdbyssError::PrintVersion),

Argument::KeyWithValue("-c" | "--config", s) => {
config.replace(PathBuf::from(s));
},

// Nothing else is expected.
Argument::Other(s) => return Err(AdbyssError::InvalidCli(s.into_boxed_str())),
Argument::InvalidUtf8(s) => return Err(AdbyssError::InvalidCli(s.to_string_lossy().into_owned().into_boxed_str())),
_ => {},
}
}

// Load configuration. If the user specified one, go with that and print an
// error if the path is invalid. Otherwise look for a config at the default
// path and go with that if it exists. Otherwise just use the internal
// default settings.
let mut shitlist =
if let Some(sh) = args.option2_os(b"-c", b"--config")
.map(PathBuf::from)
if let Some(sh) = config
.or_else(|| Some(Settings::config()).filter(|x| x.is_file()))
{
Settings::try_from(sh)?
Expand All @@ -133,15 +153,13 @@ fn _main() -> Result<(), AdbyssError> {
.into_shitlist();

// Handle runtime flags.
let systemd = args.switch(b"--systemd"); // A special mode for systemd runs.
if systemd || args.switch2(b"-y", b"--yes") {
let systemd = CLI_SYSTEMD == flags & CLI_SYSTEMD; // A special mode for systemd runs.
if systemd || CLI_YES == flags & CLI_YES {
shitlist.set_flags(FLAG_Y);
}

// Are we just removing shitlist rules?
if args.switch(b"--disable") {
return shitlist.unwrite();
}
if CLI_DISABLE == flags & CLI_DISABLE { return shitlist.unwrite(); }

// Make sure we're online if in systemd mode.
if systemd { adbyss_core::check_internet()?; }
Expand All @@ -150,7 +168,7 @@ fn _main() -> Result<(), AdbyssError> {
let shitlist = shitlist.build()?;

// Just list the results.
if args.switch(b"--show") {
if CLI_SHOW == flags & CLI_SHOW {
use std::io::Write;

let raw: String = shitlist.into_vec().join("\n");
Expand All @@ -161,7 +179,7 @@ fn _main() -> Result<(), AdbyssError> {
.and_then(|()| handle.flush());
}
// Output to STDOUT? This is like `--show`, but formatted as a hosts file.
else if args.switch(b"--stdout") {
else if CLI_STDOUT == flags & CLI_STDOUT {
use std::io::Write;

let writer = std::io::stdout();
Expand All @@ -181,7 +199,7 @@ fn _main() -> Result<(), AdbyssError> {
NiceU64::from(shitlist.len()).as_str()
);
}
else if ! args.switch2(b"-q", b"--quiet") {
else if 0 == flags & CLI_QUIET {
Msg::success(
format!(
"{} unique hosts have been cast to a blackhole!",
Expand Down
9 changes: 4 additions & 5 deletions adbyss_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "adbyss_core"
version = "0.13.0"
version = "0.13.1"
license = "WTFPL"
authors = ["Josh Stoik <[email protected]>"]
edition = "2021"
Expand All @@ -9,12 +9,11 @@ repository = "https://github.com/Blobfolio/adbyss"
publish = false

[dependencies]
argyle = "0.8.*"
dactyl = "0.7.*"
fyi_msg = "0.14.*"
fyi_msg = "1.1.*"
rayon = "1.10.*"
regex = "1.10.*"
utc2k = "0.9.*"
regex = "1.11.*"
utc2k = "0.10.*"
write_atomic = "0.5.*"

[dependencies.ahash]
Expand Down
Loading

0 comments on commit e91f217

Please sign in to comment.