Commit a6babca5 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Add IPv6 support

parent 7b5a6f49
......@@ -7,12 +7,30 @@ var config = require('../config'),
program
.version('0.0.1')
.option('-p, --port <port>', 'Port to listen for requests', parseInt)
.option('--ipv4 <address>', 'IPV4 interface to listen for requests')
.option('--ipv6 <address>', 'IPV6 interface to listen for requests')
.parse(process.argv);
config.server.port = program.port || config.server.port;
config.server.port = program.port || config.server.port;
config.server.ipv4address = program.ipv4 || config.server.ipv4address;
config.server.ipv6address = program.ipv6 || config.server.ipv6address;
var app = nodecoin.express.app(config);
http.createServer(app).listen(app.get('port'), function(){
console.log('NodeCoin server listening on port ' + app.get('port'));
});
\ No newline at end of file
if(!config.server.ipv4address){
http.createServer(app).listen(app.get('port'), function(){
console.log('NodeCoin server listening on port ' + app.get('port'));
});
}
if(config.server.ipv4address){
http.createServer(app).listen(app.get('port'), config.server.ipv4address, function(){
console.log('NodeCoin server listening on ' + config.server.ipv4address + ' port ' + app.get('port'));
});
}
if(config.server.ipv6address){
http.createServer(app).listen(app.get('port'), config.server.ipv6address, function(){
console.log('NodeCoin server listening on ' + config.server.ipv6address + ' port ' + app.get('port'));
});
}
\ No newline at end of file
exports.server = {
port : 8081
port: 8081,
ipv4address: '',
ipv6address: ''
};
......@@ -30,10 +30,30 @@ By default, nodecoin runs on port 8081. You may change it using the --port param
$ nodecoin --port 80
Note that your system may require root access to launch on port 80.
Note that your system may require root access to launch on port 80. It is also possible to specify the IPv4 interface:
$ nodecoin -p 8888 --ipv4 127.0.0.1
NodeCoin server listening on 127.0.0.1 port 8888
Or IPv6 interface:
$ nodecoin -p 8888 --ipv6 ::1
NodeCoin server listening on ::1 port 8888
Or both:
$ nodecoin -p 8888 --ipv4 127.0.0.1 --ipv6 ::1
NodeCoin server listening on 127.0.0.1 port 8888
NodeCoin server listening on ::1 port 8888
Note too that listening to multiple interfaces doesn't imply mutiple program instances: only *one* is running on multiple interfaces.
For more more details on the nodecoin command, run:
nodecoin -h
nodecoin --help
Which displays:
......@@ -44,6 +64,8 @@ Which displays:
-h, --help output usage information
-V, --version output the version number
-p, --port <port> Port to listen for requests
--ipv4 <address> IPV4 interface to listen for requests
--ipv6 <address> IPV6 interface to listen for requests
## Disclaimer
......@@ -54,6 +76,13 @@ Consequently, NodeCoin proposes its own protocol which differs with OpenUDC. How
For the moment NodeCoin is developed only by its author. If you wish to participate/debate on it, you may join OpenUDC XMPP chatroom (open-udc@muc.jappix.com) on [OpenUDC blog](http://www.openudc.org/) (chat is available on the bottom-right corner of the blog) and contact *cgeek*.
# References
* Official OpenUDC project website: <http://www.openudc.org>
* Official OpenUDC repository: <https://github.com/Open-UDC/open-udc>
* Other project trying to implement OpenUDC in python: <https://github.com/canercandan/django-openudc>
* Theoretical reference: [Relativity Theory of Money v2.718, Stephane Laborde - Nov. 2012](http://wiki.creationmonetaire.info/index.php?title=Main_Page)
# License
Copyright (c) 2013 The nodecoin team.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment