Skip to content

Commit

Permalink
save wisp-server-node and make it actually run again
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgrammerIn-wonderland committed Sep 25, 2024
1 parent 7b4d39b commit d699983
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 13 deletions.
117 changes: 117 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/ConnectionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import WebSocket, { WebSocketServer } from "ws";
import net, { Socket } from "node:net";
import dns from "node:dns/promises";
import dgram from "node:dgram";
import FrameParsers from "./Packets.ts";
import { STREAM_TYPE, PACKET_TYPE, LOG_LEVEL, WispFrame, WispOptions } from "./Types.ts";
import { Logger } from "./utils/Logger.ts";
import { handleWsProxy } from "./wsproxy.ts";
import { checkErrorCode } from "./utils/Error.ts";
import FrameParsers from "./Packets.js";
import { STREAM_TYPE, PACKET_TYPE, LOG_LEVEL, WispFrame, WispOptions } from "./Types.js";
import { Logger } from "./utils/Logger.js";
import { handleWsProxy } from "./wsproxy.js";
import { checkErrorCode } from "./utils/Error.js";

const wss = new WebSocket.Server({ noServer: true });
const wss = new WebSocketServer({ noServer: true });
const defaultOptions: WispOptions = { logLevel: LOG_LEVEL.INFO, pingInterval: 30 };
// Accepts either routeRequest(ws) or routeRequest(request, socket, head) like bare
export async function routeRequest(
Expand Down
2 changes: 1 addition & 1 deletion src/Packets.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PACKET_TYPE, WispFrame } from "./Types.ts";
import { PACKET_TYPE, WispFrame } from "./Types.js";

export function wispFrameParser(data: Buffer): WispFrame {
const uint8arrayView = new Uint8Array(data);
Expand Down
5 changes: 2 additions & 3 deletions src/createServer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { WebSocketServer } from "ws";
import wisp from "./ConnectionHandler.ts";
import wisp from "./ConnectionHandler.js";
import http from "node:http";
import { LOG_LEVEL } from "./Types.ts";
import { LOG_LEVEL } from "./Types.js";
import net, { Socket } from "node:net";

const httpServer = http.createServer().listen(process.env.PORT || 3000);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/Logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LOG_LEVEL } from "../Types.ts";
import { LOG_LEVEL } from "../Types.js";

export class Logger {
logLevel: number;
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"skipLibCheck": true,

"resolveJsonModule": false,
"emitDeclarationOnly": true,
"allowImportingTsExtensions": true
"emitDeclarationOnly": false
},
"include": ["src"]
}

0 comments on commit d699983

Please sign in to comment.