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