Unverified Commit 022a7577 authored by Isis Lovecruft's avatar Isis Lovecruft
Browse files

Merge branch 'fix/10559-keyid-in-pt-lines' into develop

parents df660bb6 4476867c
......@@ -398,7 +398,7 @@ class PluggableTransport:
self.argdict = argdict
else: self.argdict = {}
def getTransportLine(self, includeFingerprint=False):
def getTransportLine(self, includeFingerprint=False, bridgePrefix=False):
"""Get a torrc line for this pluggable transport.
This method does not return lines which are prefixed with the word
......@@ -409,18 +409,32 @@ class PluggableTransport:
:param bool includeFingerprints: If ``True``, include the digest of
this bridges public identity key in the torrc line.
:param bool bridgePrefix: If ``True``, add ``'Bridge '`` to the
beginning of each returned line (suitable for pasting directly
into a torrc file).
:rtype: str
:returns: A configuration line for adding this pluggable transport
into a torrc file.
if isinstance(self.address,ipaddr.IPv6Address):
address = "[%s]" % self.address
else: address = self.address
host = "%s %s:%d" % (self.methodname, address, self.port)
fp = ''
if includeFingerprint: fp = "keyid=%s" % self.bridge.fingerprint
args = ",".join(["%s=%s"%(k,v) for k,v in self.argdict.items()]).strip()
return "%s %s %s" % (host, fp, args)
sections = []
if bridgePrefix:
if isinstance(self.address, ipaddr.IPv6Address):
host = "%s [%s]:%d" % (self.methodname, self.address, self.port)
host = "%s %s:%d" % (self.methodname, self.address, self.port)
if includeFingerprint:
args = ",".join(["%s=%s" % (k, v) for k, v in self.argdict.items()])
line = ' '.join(sections)
return line
def parseExtraInfoFile(f):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment