Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1906)

Unified Diff: src/third_party/miniFakeDns/src/miniFakeDns.py

Issue 1729010: Enable miniFakeDns to take a port to bind to (Closed)
Patch Set: check2 Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/third_party/miniFakeDns/src/miniFakeDns.py
diff --git a/src/third_party/miniFakeDns/src/miniFakeDns.py b/src/third_party/miniFakeDns/src/miniFakeDns.py
index fbf742de13fb0cad18519ff66495d34af6545980..f1358d804ae73cbe728dd5aa22847d74b70c8562 100755
--- a/src/third_party/miniFakeDns/src/miniFakeDns.py
+++ b/src/third_party/miniFakeDns/src/miniFakeDns.py
@@ -51,14 +51,15 @@ class DNSQuery:
class DNSServer:
"""A very, very simple DNS responder.
- DNSServer will bind to port 53 on |server_address| and respond to any query
- with an A record pointing to |fake_ip|.
+ DNSServer will bind to port |port| on |server_address| and respond
+ to any query with an A record pointing to |fake_ip|.
Must be run with superuser privilege to bind to port 53
"""
- def __init__(self, server_address='', fake_ip='192.168.1.1'):
+ def __init__(self, server_address='', fake_ip='192.168.1.1', port=53):
self._udps = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self._address = server_address
+ self._port = port
self._fake_ip = fake_ip
@@ -74,7 +75,8 @@ class DNSServer:
.
stopper.set()
"""
- self._udps.bind((self._address, 53))
+ self._udps.bind((self._address, self._port))
+ print 'miniFakeDns listening on port %d' % self._port
self._udps.settimeout(1)
while not stop.is_set():
try:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698