rkik

Developer Guide

This guide describes the project architecture and how to contribute.

Project Architecture

RKIK is a Rust command-line application to query and compare NTP servers.

Code Structure

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.

Async Mode

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.

Environment Setup

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

Contribution Guidelines

  1. Fork the repository and create your feature branch.
  2. Follow the async design if you contribute to --compare.
  3. Write tests for your changes (unit or CLI).
  4. Run cargo fmt -- --check and ensure no changes are needed.
  5. Submit a pull request and reference the relevant issue.

CI/CD

The workflow ci-test-n-build.yml runs on each push. It covers:

The release.yml workflow handles:

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.

Notes