-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpydbgpproxy.patch
More file actions
28 lines (27 loc) · 1.08 KB
/
pydbgpproxy.patch
File metadata and controls
28 lines (27 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- pydbgpproxy.original 2018-01-24 15:02:46.491662000 +0000
+++ pydbgpproxy.edithere 2018-01-24 15:03:15.842313447 +0000
@@ -289,11 +289,25 @@
arg = arg.split()
return cmd, arg, line
+ def redirectForSpecialDockerDns(self, addr):
+ for hostname in ('docker.for.mac.localhost', 'docker.for.win.localhost'):
+ try:
+ ip = socket.gethostbyname(hostname)
+ if ip == '127.0.0.1':
+ continue
+ log.info("Special docker dns entry detected %s %s", hostname, ip)
+ return (ip, addr[1]);
+ except socket.error:
+ pass
+
+ return addr
+
def startNewSession(self, client, addr):
# before any communication, we can decide if we want
# to allow the connection here. return 0 to deny
data = client.recv(1024)
log.info("Server:onConnect %r [%s]", addr, data)
+ addr = self.redirectForSpecialDockerDns(addr);
try:
data = data.decode('utf-8')
except (UnicodeEncodeError, UnicodeDecodeError), e: