M .build.yml => .build.yml +2 -2
@@ 10,8 10,8 @@ secrets:
# creates /home/build/.docker/config.json
- bab5a237-674a-4992-9dfd-dbb5fd3ac176
environment:
- REPO_NAME: originz
- IMAGE_NAME: docker.io/nickbp/originz
+ REPO_NAME: kapiti
+ IMAGE_NAME: docker.io/nickbp/kapiti
IMAGE_PLATFORMS: linux/amd64,linux/arm64
BUILDAH_FORMAT: docker # 'oci' default doesn't list architectures on hub.docker.com
tasks:
M CODE-OF-CONDUCT.md => CODE-OF-CONDUCT.md +1 -1
@@ 39,7 39,7 @@ This Code of Conduct applies within all community spaces, and also applies when
## Enforcement
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement listed at [the project site](https://origi.nz). All complaints will be reviewed and investigated promptly and fairly.
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement listed at the project site. All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
M Cargo.lock => Cargo.lock +50 -50
@@ 1130,6 1130,56 @@ dependencies = [
]
[[package]]
+name = "kapiti"
+version = "0.0.1"
+dependencies = [
+ "anyhow",
+ "async-channel",
+ "async-io",
+ "async-lock",
+ "async-native-tls",
+ "async-net",
+ "async-trait",
+ "backtrace",
+ "bytecheck",
+ "byteorder",
+ "bytes",
+ "chrono",
+ "criterion",
+ "csv",
+ "flate2",
+ "futures-delay-queue",
+ "futures-lite",
+ "git-testament",
+ "http",
+ "hyper",
+ "lazy_static",
+ "libc",
+ "nix",
+ "packed_struct",
+ "packed_struct_codegen",
+ "pin-project-lite",
+ "proptest",
+ "rand",
+ "redis",
+ "retainer",
+ "rkyv",
+ "scopeguard",
+ "serde",
+ "sha2",
+ "signal-hook",
+ "smol",
+ "tempfile",
+ "tokio",
+ "toml",
+ "tracing",
+ "tracing-attributes",
+ "tracing-futures",
+ "tracing-subscriber",
+ "zstd",
+]
+
+[[package]]
name = "kv-log-macro"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ 1377,56 1427,6 @@ dependencies = [
]
[[package]]
-name = "originz"
-version = "0.0.1"
-dependencies = [
- "anyhow",
- "async-channel",
- "async-io",
- "async-lock",
- "async-native-tls",
- "async-net",
- "async-trait",
- "backtrace",
- "bytecheck",
- "byteorder",
- "bytes",
- "chrono",
- "criterion",
- "csv",
- "flate2",
- "futures-delay-queue",
- "futures-lite",
- "git-testament",
- "http",
- "hyper",
- "lazy_static",
- "libc",
- "nix",
- "packed_struct",
- "packed_struct_codegen",
- "pin-project-lite",
- "proptest",
- "rand",
- "redis",
- "retainer",
- "rkyv",
- "scopeguard",
- "serde",
- "sha2",
- "signal-hook",
- "smol",
- "tempfile",
- "tokio",
- "toml",
- "tracing",
- "tracing-attributes",
- "tracing-futures",
- "tracing-subscriber",
- "zstd",
-]
-
-[[package]]
name = "os_str_bytes"
version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
M Cargo.toml => Cargo.toml +5 -5
@@ 1,14 1,14 @@
[package]
-name = "originz"
+name = "kapiti"
version = "0.0.1"
authors = ["Nick Parker <nick@nickbp.com>"]
license-file = "LICENCE.md"
edition = "2021"
readme = "README-CRATES.md"
-description = "The Originz DNS Server"
-documentation = "https://origi.nz"
-homepage = "https://origi.nz"
-repository = "https://sr.ht/~nickbp/originz/"
+description = "The Kapiti DNS Server"
+documentation = "https://kapiti.nickbp.com"
+homepage = "https://kapiti.nickbp.com"
+repository = "https://sr.ht/~nickbp/kapiti/"
exclude = ["README.md"]
[dependencies]
M Dockerfile => Dockerfile +5 -5
@@ 10,10 10,10 @@ RUN apt-get update \
&& cargo --version \
&& cargo install cargo-build-deps \
&& cd / \
- && cargo new --bin originz
+ && cargo new --bin kapiti
-COPY . /originz
-RUN cd /originz && cargo build --release
+COPY . /kapiti
+RUN cd /kapiti && cargo build --release
# Release image: copy executable from builder
# Debian version needs to match builder image to avoid linker issues.
@@ 23,5 23,5 @@ RUN apt-get update \
&& apt-get install -y ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
-COPY --from=0 /originz/target/release/originz /originz
-RUN chmod +x /originz && /originz --version
+COPY --from=0 /kapiti/target/release/kapiti /kapiti
+RUN chmod +x /kapiti && /kapiti --version
M README-CRATES.md => README-CRATES.md +2 -2
@@ 1,5 1,5 @@
-# Originz
+# Kapiti
A Filtering DNS Cache
-For more information, visit the [project website](https://origi.nz).
+For more information, visit the [project website](https://kapiti.nickbp.com).
M README.md => README.md +3 -3
@@ 1,10 1,10 @@
-# Originz
+# Kapiti
-[](https://builds.sr.ht/~nickbp/originz/commits/.build.yml)
+[](https://builds.sr.ht/~nickbp/kapiti/commits/.build.yml)
A Filtering DNS Cache
-For more information, visit the [project website](https://origi.nz).
+For more information, visit the [project website](https://kapiti.nickbp.com).
## License
M benches/server.rs => benches/server.rs +24 -24
@@ 14,17 14,17 @@ use packed_struct::prelude::*;
use tempfile;
use tracing::{debug, error, info};
-use originz::codec::{domain_name, encoder::DNSMessageEncoder, message};
-use originz::config::Config;
-use originz::logging;
-use originz::panic;
-use originz::runner::Runner;
-use originz::specs::enums_generated::{OpCode, ResourceClass, ResourceType, ResponseCode};
-use originz::specs::message::{IntEnum, Question};
+use kapiti::codec::{domain_name, encoder::DNSMessageEncoder, message};
+use kapiti::config::Config;
+use kapiti::logging;
+use kapiti::panic;
+use kapiti::runner::Runner;
+use kapiti::specs::enums_generated::{OpCode, ResourceClass, ResourceType, ResponseCode};
+use kapiti::specs::message::{IntEnum, Question};
const LOCAL_EPHEMERAL_ENDPOINT: &str = "127.0.0.1:0";
-const STUB_QUESTION_NAME: &str = "origi.nz.";
+const STUB_QUESTION_NAME: &str = "kapiti.nickbp.com.";
const STUB_FILTER_INFO: &str = "benches/server";
const STUB_QUERY_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(1, 2, 4, 8));
@@ 249,20 249,20 @@ async fn setup_udp_requests(count: u64) -> Result<Vec<RunInputs>> {
/// Reinitializes every time so that `move` will work.
async fn run_udp_requests(
mut inputs_vec: Vec<RunInputs>,
- originz_udp_endpoint: SocketAddr,
+ kapiti_udp_endpoint: SocketAddr,
) -> Result<()> {
// Send requests for each entry in the batch
for (idx, inputs) in inputs_vec.iter().enumerate() {
let sendsize = inputs
.client_sock
- .send_to(&STUB_REQUEST[..], originz_udp_endpoint)
+ .send_to(&STUB_REQUEST[..], kapiti_udp_endpoint)
.await
.with_context(|| {
format!(
"{} Bench client send_to from {:?} to {} failed",
idx,
inputs.client_sock.local_addr(),
- originz_udp_endpoint
+ kapiti_udp_endpoint
)
})?;
debug!(
@@ 270,7 270,7 @@ async fn run_udp_requests(
idx,
sendsize,
inputs.client_sock.local_addr(),
- originz_udp_endpoint
+ kapiti_udp_endpoint
);
}
// Wait for responses to come back
@@ 284,7 284,7 @@ async fn run_udp_requests(
format!(
"{} Bench client recv_from failed from {} to {:?}",
idx,
- originz_udp_endpoint,
+ kapiti_udp_endpoint,
inputs.client_sock.local_addr()
)
})?;
@@ 324,7 324,7 @@ fn run_udp_udp_test(
async_channel::Sender<()>,
async_channel::Receiver<()>,
) = async_channel::bounded(1);
- let stop_originz = Arc::new(Barrier::new(2));
+ let stop_kapiti = Arc::new(Barrier::new(2));
// Start upstream harness
let (upstream_addr, upstream_join_handle) =
@@ 337,15 337,15 @@ fn run_udp_udp_test(
upstream_addr.to_string(),
);
- // Start originz server
+ // Start kapiti server
let runner = smol::block_on(async {
return Runner::new("benchmark".to_string(), config).await;
})?;
- let originz_udp_endpoint = runner.get_udp_endpoint()?;
- let stop_originz_copy = stop_originz.clone();
- let originz_join_handle = thread::spawn(move || smol::block_on(runner.run(stop_originz_copy)));
+ let kapiti_udp_endpoint = runner.get_udp_endpoint()?;
+ let stop_kapiti_copy = stop_kapiti.clone();
+ let kapiti_join_handle = thread::spawn(move || smol::block_on(runner.run(stop_kapiti_copy)));
- // Run benchmark: See how quickly we can get responses from originz
+ // Run benchmark: See how quickly we can get responses from kapiti
let run_count: u64 = 30;
let mut group = c.benchmark_group("server");
group.throughput(Throughput::Elements(run_count));
@@ 354,7 354,7 @@ fn run_udp_udp_test(
b.iter_batched(
move || smol::block_on(setup_udp_requests(run_count)).expect("setup failed"),
move |inputs_vec| {
- smol::block_on(run_udp_requests(inputs_vec, originz_udp_endpoint))
+ smol::block_on(run_udp_requests(inputs_vec, kapiti_udp_endpoint))
.expect("client run failed")
},
BatchSize::LargeInput,
@@ 362,11 362,11 @@ fn run_udp_udp_test(
});
group.finish();
- info!("Waiting for originz thread to exit...");
- smol::block_on(stop_originz.wait());
- originz_join_handle
+ info!("Waiting for kapiti thread to exit...");
+ smol::block_on(stop_kapiti.wait());
+ kapiti_join_handle
.join()
- .expect("failed to join originz thread")?;
+ .expect("failed to join kapiti thread")?;
info!("Waiting for upstream thread to exit...");
smol::block_on(stop_upstream_tx.send(()))?;
M examples/update_specs.rs => examples/update_specs.rs +1 -1
@@ 11,7 11,7 @@ use hyper::Method;
use sha2::{Digest, Sha256};
use tracing::{self, info};
-use originz::{fetcher::Fetcher, hyper_smol, logging};
+use kapiti::{fetcher::Fetcher, hyper_smol, logging};
fn main() -> Result<()> {
logging::init_logging();
M src/cache/redis.rs => src/cache/redis.rs +1 -1
@@ 58,7 58,7 @@ impl Cache {
scratch_buf,
// Include a hash of the DNS specs in the key used for storing data in Redis.
// Avoids potential issues with old vs new generated spec data when upgrading.
- redis_key_prefix: format!("originz_rkyv__{}__", VERSION_HASH),
+ redis_key_prefix: format!("kapiti_rkyv__{}__", VERSION_HASH),
})
}
M src/client/https.rs => src/client/https.rs +1 -1
@@ 46,7 46,7 @@ impl Client {
// Note that hyper will reject requests with "request has unsupported HTTP version",
// unless we ALSO set "http2_only(true)" in the Client builder.
.use_http_2(),
- client: hyper_smol::client_originz(resolver, true, false, 4096, timeout.clone()),
+ client: hyper_smol::client_kapiti(resolver, true, false, 4096, timeout.clone()),
timeout,
response_buffer: BytesMut::with_capacity(MAX_HTTP_BYTES as usize),
})
M src/codec/encoder.rs => src/codec/encoder.rs +1 -1
@@ 99,7 99,7 @@ impl DNSMessageEncoder {
Some(ip) => message::RDataFields::IP(ip),
None => message::RDataFields::SOA(rdata::SOAFields {
mname: orig_question.name.as_str(),
- rname: "origi.nz.",
+ rname: "kapiti.nickbp.com.",
serial: 42069,
refresh: CACHED_NXDOMAIN_TTL,
retry: 60 * 60,
M src/config.rs => src/config.rs +4 -4
@@ 11,7 11,7 @@ use serde::de;
use serde::{Deserialize, Deserializer};
use tracing::{trace, warn};
-/// The struct representation of an Originz filter section
+/// The struct representation of an Kapiti filter section
#[derive(Clone, Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ConfigFilter {
@@ 47,12 47,12 @@ pub struct ConfigFilter {
pub applies_to: String,
}
-/// The struct representation of an Originz TOML config file.
+/// The struct representation of an Kapiti TOML config file.
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Config {
/// Where temporary files, such as downloaded override/block files, should be stored.
- /// Defaults to `/tmp/originz`.
+ /// Defaults to `/tmp/kapiti`.
#[serde(default = "default_storage")]
pub storage: String,
@@ 149,7 149,7 @@ impl Config {
}
fn default_storage() -> String {
- "/tmp/originz".to_string()
+ "/tmp/kapiti".to_string()
}
fn default_user() -> String {
M src/hyper_smol.rs => src/hyper_smol.rs +3 -3
@@ 19,9 19,9 @@ use crate::timeout;
/// Returns a new Hyper HTTP client:
/// - Using smol for the connection and async runtime
-/// - Using the provided Originz Resolver for resolving any hostnames
+/// - Using the provided Kapiti Resolver for resolving any hostnames
/// This is for use when the HTTP endpoint may need "bootstrap" resolving of its own.
-pub fn client_originz(
+pub fn client_kapiti(
mut resolver: resolver::Resolver,
http2: bool,
get_ipv6: bool,
@@ 151,7 151,7 @@ pub fn client_system(http2: bool, connect_timeout: Duration) -> Client<SmolConne
) = async_channel::bounded(32);
// Create a separate task that will perform lookups on behalf of the SmolConnector.
- // This isn't strictly needed for the system resolver, but keeps things in line with client_originz().
+ // This isn't strictly needed for the system resolver, but keeps things in line with client_kapiti().
let resolver_task = Arc::new(smol::spawn(async move {
trace!("System resolver waiting for requests");
// Returns Err when channel is closed and has no more messages
M src/lib.rs => src/lib.rs +2 -2
@@ 7,7 7,7 @@ pub mod client;
/// Parsers/generators for converting raw DNS messages into equivalent framebuffer representations
pub mod codec;
-/// Utilities relating to Originz toml configuration.
+/// Utilities relating to Kapiti toml configuration.
pub mod config;
/// Client for downloading data over HTTP to local disk.
@@ 17,7 17,7 @@ pub mod fetcher;
pub mod filter;
/// Implements support for running the hyper HTTP library against smol, not tokio.
-/// This allows me to stop spending hours every 4-6 months to keep Originz on the Tokio upgrade treadmill.
+/// This allows me to stop spending hours every 4-6 months to keep Kapiti on the Tokio upgrade treadmill.
/// The hyper integration meanwhile is set up to resolve hosts against ourselves, instead of the system resolver.
pub mod hyper_smol;
M src/main.rs => src/main.rs +5 -5
@@ 11,14 11,14 @@ use nix::unistd;
use signal_hook::{consts, iterator};
use tracing::{self, debug, info};
-use originz::runner::Runner;
-use originz::{config, logging, panic};
+use kapiti::runner::Runner;
+use kapiti::{config, logging, panic};
git_testament!(TESTAMENT);
fn print_syntax() {
println!(
- "Originz DNS ({})
+ "Kapiti DNS ({})
Syntax: {} </path/to/config.toml>
@@ 40,7 40,7 @@ fn main() -> Result<()> {
if arg == "-v" || arg == "--version" {
// Special case to just print the version and exit successfully.
// Mainly useful for checking that the executable is valid in CI builds.
- println!("Originz DNS ({})", render_testament!(TESTAMENT));
+ println!("Kapiti DNS ({})", render_testament!(TESTAMENT));
return Ok(());
}
if arg.starts_with('-') {
@@ 61,7 61,7 @@ fn main() -> Result<()> {
};
// Got past logging/args, print version message before getting into config parsing
- info!("Originz DNS version {}", render_testament!(TESTAMENT));
+ info!("Kapiti DNS version {}", render_testament!(TESTAMENT));
let config = config::parse_config_file(&config_path)
.with_context(|| format!("Failed to parse TOML config: {}", config_path))?;
M src/resolver.rs => src/resolver.rs +3 -3
@@ 35,7 35,7 @@ impl Resolver {
}
/// A high-level query for getting an A/AAAA record for a given hostname string.
- /// This is only for internal host lookups by Originz itself via Hyper HTTP clients:
+ /// This is only for internal host lookups by Kapiti itself via Hyper HTTP clients:
/// - Host resolution when updating filter files
/// - Host resolution of DoH upstream servers
pub async fn resolve_str(
@@ 84,7 84,7 @@ impl Resolver {
}
/// A low-level query that accepts and returns raw DNS query payloads.
- /// This is only for outside/"real" Originz clients.
+ /// This is only for outside/"real" Kapiti clients.
pub async fn resolve_message(
&mut self,
request: &Message,
@@ 179,7 179,7 @@ impl Resolver {
}
/// Constructs a basic raw message for performing a DNS query against a given domain.
-/// This is effectively an adapter so that Originz-internal HTTP clients can use the client query path.
+/// This is effectively an adapter so that Kapiti-internal HTTP clients can use the client query path.
fn build_request(resource_type: ResourceType, host_with_period: String, udp_size: u16) -> Message {
let mut question = Vec::new();
question.push(Question {
M src/runner.rs => src/runner.rs +4 -4
@@ 25,8 25,8 @@ static DOWNLOAD_TIMEOUT_MS: u64 = 10000;
/// Hardcoded hostnames that we should block for technical reasons
static HARDCODED_BLOCKED_HOSTS: &'static [&'static str] = &[
- // Placeholder domain for users to check that Originz is working
- "test-blocked.origi.nz",
+ // Placeholder domain for users to check that Kapiti is working
+ "test-blocked.kapiti.nickbp.com",
// See https://support.mozilla.org/en-US/kb/canary-domain-use-application-dnsnet
"use-application-dns.net",
];
@@ 195,7 195,7 @@ impl Runner {
let mut filter = filter::Filter::new();
// Set up the hardcoded values first - for now they take priority over any manual configuration.
- // There isn't a good reason for a user to override a Originz test domain, for example.
+ // There isn't a good reason for a user to override a Kapiti test domain, for example.
filter.set_hardcoded_block(HARDCODED_BLOCKED_HOSTS.into())?;
let filter = Arc::new(Mutex::new(filter));
@@ 235,7 235,7 @@ impl Runner {
.name("filter-worker".to_string())
.spawn(move || {
smol::block_on(async move {
- let fetch_client = hyper_smol::client_originz(
+ let fetch_client = hyper_smol::client_kapiti(
resolver,
false,
false,
M tests/codec_property.rs => tests/codec_property.rs +1 -1
@@ 1,7 1,7 @@
use bytes::BytesMut;
use proptest::prelude::*;
-use originz::codec::{character_string, decoder, domain_name};
+use kapiti::codec::{character_string, decoder, domain_name};
proptest! {
#[test]