Files
lolympus-agent/dakao/dist/net/checkin.js
T
2026-02-02 19:14:07 -08:00

40 lines
1.3 KiB
JavaScript

/**
* LOCO Checkin — connects to the checkin server (e.g. ticket-loco.kakao.com:5242)
* over TLS with plaintext LOCO (same as booking), sends CHECKIN, and returns
* the LOCO session server host:port for the encrypted connection.
*/
import { LocoSocket } from "./socket.js";
/**
* Connect to the checkin server via TLS + plaintext LOCO,
* send CHECKIN, and return the LOCO session server address.
*/
export async function fetchCheckinServer(checkinHost, checkinPort, serverPublicKey, req) {
const config = {
host: checkinHost,
port: checkinPort,
useTLS: true,
serverPublicKey,
};
const socket = new LocoSocket(config, { plaintext: true });
try {
await socket.connect();
console.log(`[Checkin] Connected to ${checkinHost}:${checkinPort}`);
const resp = await socket.request("CHECKIN", {
userId: req.userId,
os: req.os,
ntype: req.ntype,
appVer: req.appVer,
lang: req.lang,
MCCMNC: req.MCCMNC,
});
console.log("[Checkin] CHECKIN response received");
const body = resp.body;
const host = body["host"] ?? "";
const port = body["port"] ?? 0;
return { host, port, raw: body };
}
finally {
socket.disconnect();
}
}
//# sourceMappingURL=checkin.js.map