This guide describes the project architecture and how to contribute.
RKIK is a Rust command-line application to query and compare NTP servers.
src/lib.rs
, with async logic integrated for multi-server comparison.clap
, supporting both positional and flagged arguments.rsntp
provides both sync and async APIs.SntpClient
is used for single-server queries (sync).AsyncSntpClient
is used for --compare
(async).tokio
.console
crate.src/
main.rs - CLI entry point, dispatches sync or async paths
lib.rs - Core logic, including IP resolution, sync query and async comparison
async_compare.rs - Async implementation of --compare (2+ servers)
Unit and CLI tests are in the tests/
directory.
The comparison mode (--compare s1 s2 [s3...]
) is always asynchronous, and runs all queries in parallel using futures::join_all
.
Simple queries (--server
, positional) remain synchronous for simplicity and performance.
Ensure you have the latest stable Rust toolchain:
rustup install stable
rustup default stable
Build the project:
cargo build --release
Run all tests (unit + integration):
cargo test
If you want to simulate real NTP requests in tests, enable optional network tests (not enabled by default):
cargo test --features integration-tests
--compare
.cargo fmt -- --check
and ensure no changes are needed.The workflow ci-test-n-build.yml
runs on each push. It covers:
cargo test
, cargo fmt
, and cargo clippy
The release.yml
workflow handles:
.deb
, .rpm
, static binaries)Crates published via cargo publish
are source-only, controlled via Cargo.toml: package.include
.
Packaging metadata (description, license, deb/rpm configs) is also maintained in Cargo.toml
.
join_all
over spawn
to keep async logic deterministic.