Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add listen address option, useful for IPv6 #37

Merged
merged 1 commit into from

2 participants

@Tenzer

I have a need for Bouncy to listen on both IPv4 and IPv6, but didn't find an option to specify that when using the bouncy executable, so I have implemented it as an optional third option, which lets me specify :: as the listen address making Bouncy listen on all IPv4 and IPv6 addresses available.
If no listen address is specified, 0.0.0.0 is used which has the same effect as without this patch.

@substack substack merged commit 8bffe3b into substack:master
@Tenzer Tenzer deleted the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 1 deletion.
  1. +3 −0  README.markdown
  2. +2 −1  bin/bouncy.js
View
3  README.markdown
@@ -56,6 +56,9 @@ Use a colon-separated string to specify a host and port in a route.
Use `""` for the host as a default route.
+You can optionally specify a listen address as the third parameter, it defaults
+to `0.0.0.0`. Specify `::` to listen on both IPv4 and IPv6 addresses.
+
bouncy(opts={}, cb)
===================
View
3  bin/bouncy.js
@@ -1,6 +1,7 @@
#!/usr/bin/env node
var configFile = process.argv[2];
var port = parseInt(process.argv[3], 10);
+var address = process.argv[4] || '0.0.0.0';
if (!configFile || !port) {
console.error('Usage: bouncy [routes.json] [port]');
@@ -45,4 +46,4 @@ bouncy(function (req, bounce) {
res.write('no such host');
res.end();
}
-}).listen(port);
+}).listen(port, address);
Something went wrong with that request. Please try again.