]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Add option to bind qwebirc to an IP instead of listening on all IP's.
authorsoczol <redacted>
Fri, 3 Jul 2009 12:37:58 +0000 (14:37 +0200)
committersoczol <unknown>
Fri, 3 Jul 2009 12:37:58 +0000 (14:37 +0200)
run.py
twisted/plugins/webirc.py

diff --git a/run.py b/run.py
index 57037a13a4703d0d8a6f5e2d1120ce63e57eeca5..668c22ef980dd0d28d9386b6f03dc6c4f6d00474 100755 (executable)
--- a/run.py
+++ b/run.py
@@ -32,6 +32,7 @@ parser.add_option("-b", "--debug", help="Run in the Python Debugger.", action="s
 parser.add_option("-t", "--tracebacks", help="Display tracebacks in error pages (this reveals a LOT of information, do NOT use in production!)", action="store_true", dest="tracebacks", default=False)
 parser.add_option("-r", "--reactor", help="Which reactor to use (see --help-reactors for a list).", dest="reactor", default=DEFAULT_REACTOR)
 parser.add_option("-p", "--port", help="Port to start the server on.", type="int", dest="port", default=DEFAULT_PORT)
+parser.add_option("-i", "--ip", help="IP address to listen on.", dest="ip", default="0.0.0.0")
 parser.add_option("-l", "--logfile", help="Path to twisted log file.", dest="logfile")
 parser.add_option("-c", "--clf", help="Path to web CLF (Combined Log Format) log file.", dest="clogfile")
 parser.add_option("-C", "--certificate", help="Path to SSL certificate.", dest="sslcertificate")
@@ -66,4 +67,6 @@ if options.sslcertificate and options.sslkey:
 else:
   args2+=["--port", options.port]
 
+args2+=["--ip", options.ip]
+
 run_twistd(args1, args2)
index d75c2836839526f8250945f3bde92627f079d714..2eb838321b09f065607b913e1d54013190c66ac4 100644 (file)
@@ -11,6 +11,7 @@ from qwebirc.root import RootSite
 
 class Options(usage.Options):
   optParameters = [["port", "p", "9090","Port to start the server on."],
+    ["ip", "i", "0.0.0.0", "IP address to listen on."],
     ["logfile", "l", None, "Path to web CLF (Combined Log Format) log file."],
     ["https", None, None, "Port to listen on for Secure HTTP."],
     ["certificate", "c", "server.pem", "SSL certificate to use for HTTPS. "],
@@ -47,10 +48,10 @@ class QWebIRCServiceMaker(object):
     site.displayTracebacks = not config["notracebacks"]
     if config['https']:
       from twisted.internet.ssl import DefaultOpenSSLContextFactory
-      i = internet.SSLServer(int(config['https']), site, DefaultOpenSSLContextFactory(config['privkey'], config['certificate']))
+      i = internet.SSLServer(int(config['https']), site, DefaultOpenSSLContextFactory(config['privkey'], config['certificate']), interface=config['ip'])
     else:
-      i = internet.TCPServer(int(config['port']), site)
+      i = internet.TCPServer(int(config['port']), site, interface=config['ip'])
       
     return i
   
-serviceMaker = QWebIRCServiceMaker()
\ No newline at end of file
+serviceMaker = QWebIRCServiceMaker()