[Pkg-privacy-commits] [obfsproxy] 292/353: Tweak the proxy logging a bit.
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:02:13 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository obfsproxy.
commit a2dc745745e5a827fc29a8c474268cc014c08aba
Author: George Kadianakis <desnacked at riseup.net>
Date: Wed Apr 16 16:10:13 2014 +0300
Tweak the proxy logging a bit.
Clean some long lines, and some instances of pylint's
logging-not-lazy (although the rest of the codebase has many more
instances of this).
---
obfsproxy/network/http.py | 11 +++++++----
obfsproxy/network/network.py | 9 +++++++--
obfsproxy/pyobfsproxy.py | 2 +-
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/obfsproxy/network/http.py b/obfsproxy/network/http.py
index bdf0c8b..aab1932 100644
--- a/obfsproxy/network/http.py
+++ b/obfsproxy/network/http.py
@@ -47,7 +47,8 @@ class HTTPConnectClient(HTTPClient):
self.instance_factory = instance_factory
def connectionMade(self):
- log.debug("HTTPConnectClient: Proxy connection established: %s:%d" % (log.safe_addr_str(self.proxy_addr.host), self.proxy_addr.port))
+ log.debug("HTTPConnectClient: Proxy connection established: %s:%d",
+ log.safe_addr_str(self.proxy_addr.host), self.proxy_addr.port)
self.sendCommand("CONNECT", "%s:%d" % (self.host, self.port))
if self.auth:
@@ -63,7 +64,9 @@ class HTTPConnectClient(HTTPClient):
self.onConnectionError(ConnectError("Proxy connection closed during setup"))
def handleEndHeaders(self):
- log.info("HTTPConnectClient: Connected to %s:%d via %s:%d" % (log.safe_addr_str(self.host), self.port, log.safe_addr_str(self.proxy_addr.host), self.proxy_addr.port))
+ log.info("HTTPConnectClient: Connected to %s:%d via %s:%d",
+ log.safe_addr_str(self.host), self.port,
+ log.safe_addr_str(self.proxy_addr.host), self.proxy_addr.port)
self.setRawMode()
self.instance = self.instance_factory.buildProtocol(self.proxy_addr)
@@ -79,7 +82,7 @@ class HTTPConnectClient(HTTPClient):
self.onConnectionError(ConnectError("Proxy returned status: %s" % status))
def rawDataReceived(self, data):
- log.debug("HTTPConnectClient: Received %d bytes of proxied data" % len(data))
+ log.debug("HTTPConnectClient: Received %d bytes of proxied data", len(data))
if self.instance:
self.instance.dataReceived(data)
else:
@@ -87,7 +90,7 @@ class HTTPConnectClient(HTTPClient):
def onConnectionError(self, reason):
if self.deferred:
- log.warning("HTTPConnectClient: Connect error: %s" % reason)
+ log.warning("HTTPConnectClient: Connect error: %s", reason)
self.deferred.errback(reason)
self.deferred = None
self.transport.loseConnection()
diff --git a/obfsproxy/network/network.py b/obfsproxy/network/network.py
index 2ecc08d..958728e 100644
--- a/obfsproxy/network/network.py
+++ b/obfsproxy/network/network.py
@@ -396,12 +396,17 @@ def create_proxy_client(host, port, proxy_spec, instance):
Returns a deferred that will fire when the connection to the SOCKS server has been established.
"""
- log.debug("Connecting via %s proxy %s:%d" % (proxy_spec.scheme, log.safe_addr_str(proxy_spec.hostname), proxy_spec.port))
-
TCPPoint = HostnameEndpoint(reactor, proxy_spec.hostname, proxy_spec.port)
username = proxy_spec.username
password = proxy_spec.password
+ # Do some logging
+ log.debug("Connecting via %s proxy %s:%d",
+ proxy_spec.scheme, log.safe_addr_str(proxy_spec.hostname), proxy_spec.port)
+ if username or password:
+ log.debug("Using %s:%s as the proxy credentials",
+ log.safe_addr_str(username), log.safe_addr_str(password))
+
if proxy_spec.scheme in ["socks4a", "socks5"]:
if proxy_spec.scheme == "socks4a":
if username:
diff --git a/obfsproxy/pyobfsproxy.py b/obfsproxy/pyobfsproxy.py
index bf3b6c3..f6f7bdb 100755
--- a/obfsproxy/pyobfsproxy.py
+++ b/obfsproxy/pyobfsproxy.py
@@ -131,7 +131,7 @@ def consider_cli_args(args):
try:
proxy = parseProxyURI(args.proxy)
except Exception as e:
- log.error("Failed to parse proxy specifier: %s" % e)
+ log.error("Failed to parse proxy specifier: %s", e)
sys.exit(1)
def run_transport_setup(pt_config):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/obfsproxy.git
More information about the Pkg-privacy-commits
mailing list