summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-11 21:48:48 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-11 21:48:48 +1000
commit4dab3a9bbe3c043a441bf23bdb496c9f308bee15 (patch)
tree047e2fb82ba36099eed2fb5a4b53c26ecabc6994
parentAdded missing props to ChannelModifySchema (diff)
downloadserver-4dab3a9bbe3c043a441bf23bdb496c9f308bee15.tar.xz
Trash ip logging
-rw-r--r--gateway/src/events/Connection.ts4
-rw-r--r--gateway/src/opcodes/Identify.ts4
-rw-r--r--gateway/src/util/WebSocket.ts1
3 files changed, 7 insertions, 2 deletions
diff --git a/gateway/src/events/Connection.ts b/gateway/src/events/Connection.ts

index af897ed7..bed3cf44 100644 --- a/gateway/src/events/Connection.ts +++ b/gateway/src/events/Connection.ts
@@ -26,12 +26,14 @@ export async function Connection( const forwardedFor = Config.get().security.forwadedFor; const ipAddress = forwardedFor ? request.headers[forwardedFor] as string : request.socket.remoteAddress; + socket.ipAddress = ipAddress; + try { // @ts-ignore socket.on("close", Close); // @ts-ignore socket.on("message", Message); - console.log(`[Gateway] New connection from ${ipAddress}, total ${this.clients.size}`); + console.log(`[Gateway] New connection from ${socket.ipAddress}, total ${this.clients.size}`); const { searchParams } = new URL(`http://localhost${request.url}`); // @ts-ignore diff --git a/gateway/src/opcodes/Identify.ts b/gateway/src/opcodes/Identify.ts
index 57c45d1f..bd36e052 100644 --- a/gateway/src/opcodes/Identify.ts +++ b/gateway/src/opcodes/Identify.ts
@@ -237,7 +237,7 @@ export async function onIdentify(this: WebSocket, data: Payload) { const d: ReadyEventData = { v: 8, - application, + application: application ?? undefined, user: privateUser, user_settings: user.settings, // @ts-ignore @@ -296,4 +296,6 @@ export async function onIdentify(this: WebSocket, data: Payload) { //TODO send VOICE_STATE_UPDATE to let the client know if another device is already connected to a voice channel await setupListener.call(this); + + console.log(`${this.ipAddress} identified as ${d.user.id}`) } diff --git a/gateway/src/util/WebSocket.ts b/gateway/src/util/WebSocket.ts
index 1ca90340..7ac277a8 100644 --- a/gateway/src/util/WebSocket.ts +++ b/gateway/src/util/WebSocket.ts
@@ -8,6 +8,7 @@ export interface WebSocket extends WS { session_id: string; encoding: "etf" | "json"; compress?: "zlib-stream"; + ipAddress?: string; shard_count?: bigint; shard_id?: bigint; deflate?: Deflate;