Skip to content

BinkP feature updates#691

Merged
NuSkooler merged 4 commits into
masterfrom
binkp-feat-updates1
May 18, 2026
Merged

BinkP feature updates#691
NuSkooler merged 4 commits into
masterfrom
binkp-feat-updates1

Conversation

@NuSkooler
Copy link
Copy Markdown
Owner

Adds compression, FREQ, etc.

NuSkooler added 4 commits May 14, 2026 16:19
Adds the remaining robustness features to the native BinkP mailer:

**TLS (binkps)**
- Outbound: per-node `tls: true` with trust options `tlsAllowSelfSigned`,
  `tlsFingerprint`, `tlsCertFile`; validated before acquiring the .bsy lock
- Inbound: optional TLS server on configurable port (defaults 24555) in
  parallel with the plain server

**ND / NDA (FTS-1028)**
- Advertised in OPT during handshake; `_useND` flag set on negotiation
- `_applyDisposition` respects ND — truncates instead of deleting when active

**GZ compression (FTS-1029 + EXTCMD)**
- Negotiated via OPT; per-file `GZ` token in M_FILE when EXTCMD is active
- Skips pre-compressed extensions (.zip, .arc, arcmail bundles, etc.)
- Decompresses via zlib on receive; zero-copy streaming on send

**Multi-batch (onBatchEnd hook)**
- `onBatchEnd(session)` option: async hook called when both sides exchange
  M_EOB; if it queues new files the session starts another batch
- Answering side defers its M_EOB until the remote's M_EOB is received,
  giving async handlers time to resolve FREQ requests before EOB goes out
- `holdEOB()` / `releaseEOB()` public API for async handlers that need to
  delay M_EOB while resolving files
- `incoming-file` event fires on M_FILE receipt (before async write) so
  FREQ handlers can hold EOB without racing the writeStream finalization
- Graceful FIN (`socket.end()`) in `_destroy(graceful=true)` ensures all
  buffered data (including trailing M_EOB) reaches the peer before close
- `_waitingForClose` + `cleanEnd` fallback in `_onSocketClose` for the
  race where socket closes before `_waitingForClose` is set

**FREQ (file request)**
- `core/binkp/freq.js`: `FreqResolver` class — magic-name map + versioned
  directory search (newest file by prefix wins, e.g. NODELIST.365)
- `attachFreqToSession(session, resolver, opts)`: wires `incoming-file`
  (holdEOB) + `file-received` (resolve + queueFile + releaseEOB) so FREQ
  responses go out in the same session batch as the originating mail
- `readReqFileSync`: reads .req content synchronously inside the
  `file-received` listener, before any spool handler moves the temp file
- Configured via `scannerTossers.ftn_bso.binkp.freq` (magic, dirs,
  maxFiles, requirePwd)

**Tests** (1324 passing, 0 failing)
- GZ round-trip: transfers file with compression; skips GZ for .zip
- Multi-batch: second batch via onBatchEnd; clean end; hook rejection
- FREQ unit: magic names, case-insensitive lookup, prefix versioning,
  exact match, maxFiles cap, .req file parsing with password stripping
- FREQ e2e: server serves nodelist in same batch; skips when no .req sent
- config_default.js: add commented-out freq block under binkp with
  magic, dirs, maxFiles, requirePwd keys and inline documentation
- docs/messageareas/binkp.md: add TLS, GZ, multi-batch, and FREQ to
  the feature list and config example; add reference sections for
  binkp.inbound.tls, binkp.nodes[].tls, and binkp.freq
FreqResolver now supports three resolution sources (magic → areas → dirs):

- Glob magic: magic paths may contain wildcards; newest matching file
  returned at request time, so NODELIST.* always serves the current
  segment without config changes after each weekly update
- File base area resolver: queries ENiGMA file base areas by areaTag,
  using upload_timestamp for newest-wins ordering — the right answer
  for TIC-imported content (nodelist arrives via TIC → immediately
  FREQ-serveable by pointing freq.areas at the same area tag)
- dirs resolver unchanged; serves as fallback for files outside the
  file base

maxFiles cap applies across all three resolvers combined.
Add 12 new tests (glob magic × 4, area resolver × 4, existing × unchanged).
Update config_default.js comments and binkp.md operator guide.
Comment thread core/binkp/caller.js Dismissed
Comment thread core/binkp/caller.js Dismissed
@NuSkooler NuSkooler merged commit d00f48d into master May 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants