Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using existing socket to initiate IRC session e.g. using SOCKS proxy #553

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/irc.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function Client(server, nick, opt) {
realName: 'nodeJS IRC client',
port: 6667,
localAddress: null,
existingSocket: null,
debug: false,
showErrors: false,
autoRejoin: false,
Expand Down Expand Up @@ -792,6 +793,11 @@ Client.prototype.connect = function(retryCount, callback) {
util.log(self.conn.authorizationError);
}
});
} else if (self.opt.existingSocket) {
// must be an already connected socket, e.g. from socks proxy
self.conn = self.opt.existingSocket;
// call connection handler asynchronously, emulating connection success
setTimeout(self._connectionHandler.bind(self), 0);
} else {
self.conn = net.createConnection(connectionOpts, self._connectionHandler.bind(self));
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"Chris Nehren <[email protected]>",
"Henri Niemeläinen <[email protected]>",
"Alex Miles <[email protected]>",
"Simmo Saan <[email protected]>"
"Simmo Saan <[email protected]>",
"e-neko <[email protected]>"
],
"repository": {
"type": "git",
Expand Down