Add packaging & split code.

This commit is contained in:
JOLIMAITRE Matthieu 2025-05-28 18:42:43 +02:00
parent 8346df8a57
commit 34123a7e5a
10 changed files with 445 additions and 93 deletions

17
src/kub-tcp-service.ts Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env -S deno run -A
import { History } from "./lib/history.ts"
import { pick_name_for } from "./lib/names.ts"
import { listen } from "./lib/listen.ts"
import { session } from "./lib/session.ts"
const history_limit = 500
const history_path = "./history.json"
const port = 4800
async function main() {
const history = await History.load(history_path, history_limit) ?? await History.create(history_path, history_limit)
listen(port, (conn) => session(conn, pick_name_for(conn.remoteAddr.hostname), history))
}
if (import.meta.main) await main()