Skip to content

Commit

Permalink
fix: Socket reference error
Browse files Browse the repository at this point in the history
- Closes #30.
  • Loading branch information
roj1512 committed Nov 20, 2022
1 parent d6fcd50 commit 3b9b8e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion deps.ts
Expand Up @@ -32,7 +32,13 @@ export {
Parser,
} from "https://ghc.deno.dev/tbjgolden/deno-htmlparser2@1f76cdf/htmlparser2/Parser.ts";

export { type Socket } from "https://deno.land/std@0.164.0/node/net.ts";
import { type Socket as Socket_ } from "https://deno.land/std@0.164.0/node/net.ts";

export let Socket = null as unknown as typeof Socket_;

if (typeof document === "undefined") {
Socket = (await import("https://deno.land/std@0.164.0/node/net.ts")).Socket;
}

import { type SocksClient as SocksClient_ } from "https://deno.land/x/deno_socks@v2.6.1/mod.ts";

Expand Down
4 changes: 2 additions & 2 deletions src/extensions/promised_net_sockets.ts
@@ -1,12 +1,12 @@
// deno-lint-ignore-file no-explicit-any
import { Buffer, Mutex, type Socket, SocksClient } from "../../deps.ts";
import { Buffer, Mutex, Socket, SocksClient } from "../../deps.ts";
import { ProxyInterface } from "../network/connection/types.ts";

const mutex = new Mutex();
const closeError = new Error("NetSocket was closed");

export class PromisedNetSockets {
private client?: Socket;
private client?: InstanceType<typeof Socket>;
private closed: boolean;
private stream: Buffer;
private canRead?: boolean | Promise<boolean>;
Expand Down

0 comments on commit 3b9b8e7

Please sign in to comment.