mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
The @honeybbq/teamspeak-client library already handles TS6 license block type 8 (Ts5Server) in its handshake, so voice connections work with both TS3 and TS6 servers. This commit adds the surrounding infrastructure: - protocol-detect.ts: Auto-detect server type by probing TS3 ServerQuery (port 10011) and TS6 HTTP Query (port 10080) in parallel - http-query.ts: TS6 HTTP Query client replacing the raw-TCP ServerQuery that TS6 servers no longer support (ports 10080/10443) - client.ts: Protocol-aware connection with auto-detection, TS6 HTTP Query setup, and forced protocol override option - manager.ts: Pass through serverProtocol and ts6ApiKey config options - connection.ts: Mark legacy TS3 ServerQuery as deprecated for TS6 https://claude.ai/code/session_016WhH58avUD9xy2dgADJgTh
24 lines
830 B
TypeScript
24 lines
830 B
TypeScript
import { describe, it, expect } from "vitest";
|
|
import {
|
|
detectServerProtocol,
|
|
type ServerProtocol,
|
|
type ProtocolDetectResult,
|
|
} from "./protocol-detect.js";
|
|
|
|
describe("protocol-detect", () => {
|
|
it("returns unknown for unreachable hosts", async () => {
|
|
const result = await detectServerProtocol("192.0.2.1", 9987, 1000);
|
|
expect(result.protocol).toBe("unknown");
|
|
expect(result.queryPort).toBeNull();
|
|
expect(result.voicePort).toBe(9987);
|
|
});
|
|
|
|
it("result shape matches ProtocolDetectResult interface", async () => {
|
|
const result = await detectServerProtocol("127.0.0.1", 9987, 500);
|
|
expect(result).toHaveProperty("protocol");
|
|
expect(result).toHaveProperty("queryPort");
|
|
expect(result).toHaveProperty("voicePort");
|
|
expect(["ts3", "ts6", "unknown"]).toContain(result.protocol);
|
|
});
|
|
});
|