From ba4be1321b9ccbf78c83ac70f7dde7908b649c86 Mon Sep 17 00:00:00 2001 From: PondWader <66561610+PondWader@users.noreply.github.com> Date: Fri, 17 May 2024 09:54:04 +0100 Subject: [PATCH] Export defaultConnectionHandler --- src/connectionHandler.ts | 2 ++ src/index.ts | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/connectionHandler.ts b/src/connectionHandler.ts index a730a1b..1ffacc4 100644 --- a/src/connectionHandler.ts +++ b/src/connectionHandler.ts @@ -45,4 +45,6 @@ export default function (connection: InitialisedSocks5Connection, sendStatus: (s }) connection.socket.on('close', () => stream.destroy()); + + return stream; } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index f7d8f74..f63e619 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,5 @@ import Socks5Server from "./Server"; +import connectionHandler from "./connectionHandler"; type ServerOptions = { auth?: { @@ -14,11 +15,11 @@ export function createServer(opts?: ServerOptions) { if (opts?.auth) server.setAuthHandler((conn) => { return conn.username === opts.auth!.username && conn.password === opts.auth!.password - }) + }) if (opts?.port) server.listen(opts.port, opts.hostname); return server; } -export { Socks5Server }; \ No newline at end of file +export { Socks5Server, connectionHandler as defaultConnectionHandler }; \ No newline at end of file