1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00
Files
BakaShrot/Source/README.md
T
aziascreations 17ec69c03c Removed the PureBasic version, Fixed refused certificates seen as lost connections
OldSource/ is deleted, with its PB-MessagePack submodule: it stays in git
history (up to 68966a8). What of its notes still holds is in
Source/docs/known-issues.md (the threat model, the known limits, ideas
for later); the old Docker image's publishing notes are in revamp.md's
step 13, the wheel's and releases' in Source/README.md. The Rust tests
are now the one runner. readme.md describes the Rust version.

The server now closes gently after refusing a certificate (shutdown,
then reading until the client closes, 1 s at most): closing at once
reset the connection, which could beat TLS's alert to the client
(ConnectionLost instead of AuthRejected, 14 of 160 runs under load).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 00:42:19 +01:00

4.5 KiB

BakaShrot - new sources (Rust)

The new implementation, see ../revamp.md (why, decisions, the plan and where it stands).

Layout

A Cargo workspace. What's marked with a step number is planned, added by that step of the plan; the rest exists:

Source/
  Cargo.toml              the workspace: shared lints, release profile
  rust-toolchain.toml     the pinned toolchain (1.100.0)
  check.ps1               what CI runs: fmt, clippy, tests, docs
  release.py              a release for this platform: build, package, smoke test
  docs/                   designs across crates: protocol.md, certificates.md, oid.md, config.md,
                          storage.md, server.md, client.md, known-issues.md
  crates/
    bakashrot-proto/      packets, frames, names, limits, error codes, shared by everything
    bakashrot-pki/        certificates: issuing, identities, CRLs, the TLS setup
    bakashrot-config/     the server's config (TOML): topics, retention, replication, roles
    bakashrot-storage/    SQLite, schema v9: the writer, reads, attachments, queries
    bakashrot-server/     the server: TLS, identities, requests, the writer thread (and its program)
    bakashrot-client/     the client library, Rust API, blocking
    bakashrot-capi/       the C DLL over bakashrot-client: the BakaShrot_* exports (bakashrot.dll)
    bakashrot-tools/      the CLI tools: bakashrot (push, read, query, list), bakashrot-cert
  bindings/
    c/                    bakashrot.h, generated from bakashrot-capi
    purebasic/            the prototypes and error codes, as the PureBasic version's
    python/               bakashrot.py over the DLL, check_bakashrot.py, make_wheel.py
  .cargo/config.toml      the C runtime linked statically on Windows
  tests/                  (13) end-to-end suites across processes

Dependencies only point downward: proto, pki, config and storage don't open sockets and are tested on their own; server and client use them; the DLL and the tools only use client.

Building and checking

  • cargo build, cargo test from Source/ (rustup picks the pinned toolchain).
  • powershell -ExecutionPolicy Bypass -File Source\check.ps1: everything CI checks (../.github/workflows/source.yml), warnings are errors.
  • Output in target/ (git-ignored). Generated keys and certificates never go in git.

Releases

python release.py (Python 3.11+) on Windows x64 or Linux x86-64 builds that platform's release into target/dist/bakashrot-<version>-<platform>/ and its archive (.zip, .tar.gz): the server, bakashrot, bakashrot-cert, the client library with its C header and PureBasic prototypes, bakashrot.py and a wheel with the library in it (bindings/python/make_wheel.py), the example configs, docs/, a README.txt, the licenses (THIRD-PARTY.txt: every crate built in, from cargo metadata). Then it checks it, in the folder's _test/: a CA and certificates, the server on a free port, the tool pushing (an attachment too), reading back, listing and querying, Python through the library and the wheel installed by pip, the server stopped by SIGTERM (Ctrl+Break on Windows), which must end cleanly (_test/ kept if not); --skip-test.

CI runs it on a version tag (v*) or by hand, keeping the archives: the Linux one in a manylinux 2.28 container, so it runs with glibc 2.28 and later. The version is the workspace's (Cargo.toml), and bindings/python/bakashrot.py's __version__ must be the same.

Publishing, as the old version did:

  • The wheel to Gitea's registry, with twine 6.1+ (for the license metadata) and a token with write:package: twine upload --repository-url https://git.nibblepoker.lu/api/packages/aziascreations/pypi -u aziascreations <wheel>.
  • On GitHub (no Python registry), the archives and the wheels on a release: gh release create v<version> --repo aziascreations/BakaShrot --title <version> <files> (gh release upload for one that exists).

Conventions

  • LF line endings (.gitattributes), rustfmt's defaults.
  • Every public item documented (missing_docs), no unsafe outside the C API crate.
  • A crate's root docs say what it does; designs that span crates go in docs/, updated with the code.
  • Use existing crates rather than reimplementing (MessagePack is rmp-serde).
  • Protocol changes update docs/protocol.md; error codes are never renumbered, packet ids never reused.
  • OldSource/ paths in comments and docs: the PureBasic version, removed 2026-11-15, in git history up to commit 68966a8.