aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed <git@gumx.cc>2026-06-17 15:23:51 +0300
committerAhmed <git@gumx.cc>2026-06-17 15:23:51 +0300
commitff7fc47622fbca3b8c6281d887ee132af3632f1a (patch)
tree119ef127422c5d08d5129634abd503ffbaf24f6a
parent48f6bf9cff66607627480cd642ceae7fe349d959 (diff)
fix: removed unneeded ws-irc-bridge
-rw-r--r--scripts/ws-irc-bridge.py54
1 files changed, 0 insertions, 54 deletions
diff --git a/scripts/ws-irc-bridge.py b/scripts/ws-irc-bridge.py
deleted file mode 100644
index cca3375..0000000
--- a/scripts/ws-irc-bridge.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python3
-"""
-WebSocket-to-IRC bridge for gamja anonymous web client.
-Each WebSocket connection gets its own TCP connection to ngircd.
-Listens on 127.0.0.1:7778, forwards to 127.0.0.1:6667.
-"""
-import asyncio
-import websockets
-
-WS_HOST = "127.0.0.1"
-WS_PORT = 7778
-IRC_HOST = "127.0.0.1"
-IRC_PORT = 6667
-
-
-async def bridge(ws):
- try:
- reader, writer = await asyncio.open_connection(IRC_HOST, IRC_PORT)
- except OSError:
- await ws.close()
- return
-
- async def ws_to_irc():
- try:
- async for msg in ws:
- data = msg if isinstance(msg, bytes) else msg.encode()
- writer.write(data)
- await writer.drain()
- except Exception:
- pass
- finally:
- writer.close()
-
- async def irc_to_ws():
- try:
- while True:
- data = await reader.read(4096)
- if not data:
- break
- await ws.send(data)
- except Exception:
- pass
- finally:
- await ws.close()
-
- await asyncio.gather(ws_to_irc(), irc_to_ws())
-
-
-async def main():
- async with websockets.serve(bridge, WS_HOST, WS_PORT):
- await asyncio.Future()
-
-
-asyncio.run(main())