From 378372e666fb211e50ff30d570fc0f56cf288d16 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Sun, 18 Dec 2016 08:06:56 +0900 Subject: [PATCH] Logs: show IPv6 address + port correctly Closes #79 --- lib/jsonrpc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/jsonrpc.py b/lib/jsonrpc.py index c13cc15..9a74eaa 100644 --- a/lib/jsonrpc.py +++ b/lib/jsonrpc.py @@ -177,7 +177,10 @@ class JSONRPC(asyncio.Protocol, LoggedClass): return 'unknown' if for_log and self.anon_logs: return 'xx.xx.xx.xx:xx' - return '{}:{}'.format(self.peer_info[0], self.peer_info[1]) + if ':' in self.peer_info[0]: + return '[{}]:{}'.format(self.peer_info[0], self.peer_info[1]) + else: + return '{}:{}'.format(self.peer_info[0], self.peer_info[1]) def connection_made(self, transport): '''Handle an incoming client connection.'''