Skip to content

Comments

feature(sockets): Add the option to use unix sockets instead of a hostname / port combination#399

Open
WickedSik wants to merge 2 commits intokiwiirc:masterfrom
WickedSik:feature/socket-connections
Open

feature(sockets): Add the option to use unix sockets instead of a hostname / port combination#399
WickedSik wants to merge 2 commits intokiwiirc:masterfrom
WickedSik:feature/socket-connections

Conversation

@WickedSik
Copy link

@WickedSik WickedSik commented Feb 18, 2026

Add Unix domain socket support to the Node.js transport layer.

This allows connecting to IRC servers (or bouncers like ZNC) via Unix sockets instead of TCP host/port, which is useful when the IRC daemon runs on the same machine. Connections can be plain or TLS-wrapped.

What changed:

  • src/transports/net.js — Extended the connection logic to accept a path option for Unix domain sockets. When path is provided, it takes priority over host/port. Supports both plain (net.connect) and TLS (tls.connect) modes, including client certificates and rejectUnauthorized.

  • test/net.transport.test.js — Added a comprehensive test suite for the net transport. Covers plain TCP, TLS, Unix socket, and TLS-over-Unix-socket connection modes. Also covers socket lifecycle methods (close, disposeSocket, writeLine, onSocketData, etc.) and address family detection — none of which had dedicated tests before.

  • README.md / docs/clientapi.md — Updated documentation with Unix socket usage examples and the new path connect option.

Usage:

client.connect({ path: '/tmp/irc.sock', nick: 'bot' });
// or with TLS
client.connect({ path: '/tmp/irc.sock', tls: true, nick: 'bot' });

When path is set, host and port are ignored. No breaking changes to existing connection behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants