Practical CLI Examples
Real-world production examples covering file transfers, secure chat, stress benchmarks, packet capture, certificate authorities, and gateway bridging.
Below are 9 complete real-world examples demonstrating how to use ksp across networking, security hardening, and protocol debugging scenarios.
High-Speed File Transfer (`transfer` & `receive`)
Transfer large ISO images or database backups securely without intermediate HTTP server overhead:
# Receiver side (Listens on port 9876 and saves into ./backups) ksp receive --out-dir ./backups --port 9876 --require-auth # Sender side (Split file into 64KB stream chunks with LZ4 compression) ksp transfer ./production.dump --to 192.168.10.50:9876 --compress
Peer-to-Peer Encrypted Terminal Chat (`chat`)
Establish an ephemeral X25519 Diffie-Hellman encrypted terminal chat session between two developers:
# Developer 1 — Host the secure chat room ksp chat listen --port 9876 --nick Kush # Developer 2 — Connect to the room ksp chat connect 192.168.1.10:9876 --nick Alice
Throughput Stress Benchmarking (`benchmark`)
Stress test server concurrency by opening 128 simultaneous multiplexed streams over a single connection:
ksp benchmark 127.0.0.1:9876 --streams 128 --payload 16384 --duration 10 --cipher aes-256-gcm
Real-Time TUI Dashboard (`dashboard`)
Launch Ratatui-powered terminal user interfaces showing real-time latency histograms and stream gauges:
ksp dashboard --theme cyberpunk
Live Packet Capture & Keylog (`capture` & `wireshark`)
Record live network traffic to a pcapng trace and write out ephemeral decryption keys for Wireshark analysis:
# Record traffic on loopback interface and export SSLKEYLOGFILE secret keys ksp capture -i lo --port 9876 -w session.pcapng --dump-keys session.keys # Install Wireshark dissector plugin and open the trace ksp wireshark install && ksp wireshark --open session.pcapng
Sliding Window Replay Simulation (`replay`)
Replay captured historical packets against an endpoint to verify that the 1024-packet sliding window rejects duplicates:
ksp replay --trace session.pcapng --target 127.0.0.1:9876 --speed 2.0
Enterprise CA & Certificate Generation (`cert`)
Create a local Root Certificate Authority (CA) and sign downstream server binary certificates:
# 1. Generate Root Authority Key Pair and Certificate ksp cert generate-ca --subject "KSP Enterprise Root CA" --out-cert ca.cert --out-key ca.key # 2. Sign a Server Certificate for internal service domain ksp cert sign --ca-cert ca.cert --ca-key ca.key --subject "api.service.internal" --out-cert server.cert
Ingress Gateway Bridge (`gateway`)
Run an enterprise ingress gateway terminating encrypted KSP client sessions and routing to internal HTTP/WS services:
ksp gateway --config gateway.toml --port 9876 --tls-terminate
Transparent Local Forwarder Proxy (`proxy`)
Forward local unencrypted TCP traffic across an encrypted KSP tunnel with real-time stream inspection:
ksp proxy --listen 127.0.0.1:8080 --target ksp://secure-upstream.cloud:9876 --inspect