]> jfr.im git - irc/freenode/jbnc.git/commitdiff
Listen on IP option
authorrealrasengan <redacted>
Wed, 20 May 2020 19:12:23 +0000 (19:12 +0000)
committerrealrasengan <redacted>
Wed, 20 May 2020 19:12:23 +0000 (19:12 +0000)
README.md
bouncer.js
examples/example-gateway.conf
examples/example-singleuser.conf
examples/example.conf

index a9e7db361d8747e27d1c7efcc71fe7d1a92c9bcd..13a58d8463e2d26d9ded6b6390b20b7f193ec68f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -47,6 +47,7 @@ webircPassword: if its there, it will try webirc authentication
 webircHashIp: true or false if you want to just hide their ip but provide a hash
 webircProxy: true or false if you want to pass their real ip (only matters with stunnel)
 ingresswebircPassword: a password for webirc clients to use when connecting to jbnc
+bouncerIp: ip you want to bind to or leave null
 bouncerPort: port for bnc (do "+6697" if you want SSL (wrap in "" and put +)),
 bouncerAdmin: admin pass
 bouncerShack: ping ack timeout
index fea2fa20165f354efb4325777f6b8148ddecab81..00e24c88117ebaad4870fd10058e0ff57223ec3e 100644 (file)
@@ -16,6 +16,7 @@ else process.exit(1);
 
 // Set config vars
 var BOUNCER_PORT = config.bouncerPort?config.bouncerPort:8888;
+const BOUNCER_IP = config.bouncerIp?config.bouncerIp:null;
 const BOUNCER_USER = config.bouncerUser?config.bouncerUser:'';
 var BOUNCER_PASSWORD = config.bouncerPassword?config.bouncerPassword:'';
 var BOUNCER_ADMIN = config.bouncerAdmin?config.bouncerAdmin:'';
@@ -673,6 +674,8 @@ function clientConnect(socket) {
     _success=false;
   }
   if(_success) {
+    if(DEBUG)
+      console.log("Starting connect");
     // bouncer connections
     connection.parents = [];
     connection.parents[0] = socket;
@@ -709,6 +712,8 @@ function clientConnect(socket) {
 
     connection.on('connect',async function() {
       this.write("CAP LS 302\n");
+      if(DEBUG)
+        console.log("CAP LS 302");
       if(SERVER_WEBIRC.length>0) {
         if(this.host==":1")
           this.host="127.0.0.1";
@@ -732,6 +737,8 @@ function clientConnect(socket) {
       this.write('NICK '+this.nick+'\n');
       this.write('USER '+this.user+' * 0 :'+this.realname+'\n');
       connections[hash(this.nick_original+this.user+this.password+this.server+this.port.toString())] = this;
+      if(DEBUG)
+        console.log("Connection created.");
     });
     connection.on('data', function(d){
       if(d.toString().substr(d.length-1)!="\n")
@@ -1150,5 +1157,8 @@ function clientConnect(socket) {
     socket.end();
   }
 }
+if(BOUNCER_IP)
+  server.listen(BOUNCER_PORT, BOUNCER_IP);
+else
+  server.listen(BOUNCER_PORT);
 
-server.listen(BOUNCER_PORT);
index 1b4fc4e26d04eda4d4fc0647588977097af74358..0b8a96841589b7e43a2832c53209c3c19e0be13a 100644 (file)
@@ -3,6 +3,7 @@
   "bouncerUser":"",
   "bouncerPassword":"",
   "bouncerShack":10,
+  "bouncerIp":null,
 
   "serverPort":"6667",
   "server":"127.0.0.1",
index 66bf14c5c12fc4e922f20ac5b83e91f0f71ba265..167653c7a500b04f5377aacc6800815297b4b187 100644 (file)
@@ -3,6 +3,7 @@
   "bouncerUser":"johnsmith",
   "bouncerPassword":"JFiwefani32",
   "bouncerShack":10,
+  "bouncerIp":null,
 
   "serverPort":"",
   "server":"",
index 4287bfb94721c483f5d02b88758263b0c0ab35dc..2fe67edddb16a272a8abf75ce7e47063fb132f81 100644 (file)
@@ -3,6 +3,7 @@
   "bouncerUser":"",
   "bouncerPassword":"",
   "bouncerShack":10,
+  "bouncerIp":null,
 
   "serverPort":"",
   "server":"",