Skip to content

Commit

Permalink
chore: use node apis
Browse files Browse the repository at this point in the history
  • Loading branch information
c43721 committed Oct 27, 2024
1 parent 7a03ca2 commit ba54acc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/rcon.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import protocol from "./protocol.ts";
import { iterateReader } from "@std/io";
import { concat } from "@std/bytes";
import { createConnection, type Socket } from "node:net";
import { encode, decode } from "./packet.ts";
import {
NotAuthenticatedException,
Expand Down Expand Up @@ -34,7 +35,7 @@ import type { RconOptions } from "./types.ts";
export default class Rcon {
#host: string;
#port: number;
#connection?: Deno.Conn;
#connection?: Socket;
#connected = false;
#authenticated = false;
#maxPacketSize = 4096;
Expand Down Expand Up @@ -116,15 +117,15 @@ export default class Rcon {
public disconnect() {
this.#authenticated = false;
this.#connected = false;
this.#connection?.close();
this.#connection?.end();
}

/**
* Connects to the SRCDS server
*/
async #connect() {
this.#connection = await Deno.connect({
hostname: this.#host,
#connect() {
this.#connection = createConnection({
host: this.#host,
port: this.#port,
});

Expand Down

0 comments on commit ba54acc

Please sign in to comment.