Clarify this is not for use with a SOCKS proxy

This commit is contained in:
Andrew Morgan 2019-01-16 17:36:16 +00:00
parent 2c9ce72071
commit 1128d9b9b2
2 changed files with 12 additions and 10 deletions

View file

@ -109,8 +109,8 @@ class ServerConfig(Config):
)
# Optional proxy address for federation traffic
self.proxy_federation_requests_address = config.get(
"proxy_federation_requests_address", None
self.federation_request_gateway_addr = config.get(
"federation_request_gateway_addr", None
)
# turn the whitelist into a hash for speed of lookup
@ -119,10 +119,10 @@ class ServerConfig(Config):
for domain in federation_domain_whitelist:
self.federation_domain_whitelist[domain] = True
if self.proxy_federation_requests_address is not None:
if self.federation_request_gateway_addr is not None:
# Ensure proxy address is correctly formatted
if len(self.proxy_federation_requests_address.split(':')) != 2:
self.proxy_federation_requests_address = None
if len(self.federation_request_gateway_addr.split(':')) != 2:
self.federation_request_gateway_addr = None
if self.public_baseurl is not None:
if self.public_baseurl[-1] != '/':
@ -300,8 +300,10 @@ class ServerConfig(Config):
# - nyc.example.com
# - syd.example.com
# Proxy outbound federation requests through a seperate HTTP proxy.
# proxy_federation_requests_address: localhost:1234
# Send outbound federation requests through a seperate traffic gateway.
# Not intended to be used with a SOCKS proxy, but rather a relay for
# HTTP traffic.
# federation_request_gateway_addr: localhost:1234
# List of ports that Synapse should listen on, their purpose and their
# configuration.

View file

@ -71,7 +71,7 @@ class ProxyMatrixFederationEndpointFactory(object):
def endpointForURI(self, uri):
return matrix_federation_endpoint(
self.reactor, self.hs.proxy_federation_requests_address, timeout=10,
self.reactor, self.hs.federation_request_gateway_addr, timeout=10,
tls_client_options_factory=None
)
@ -196,14 +196,14 @@ class MatrixFederationHttpClient(object):
self.hs = hs
self.signing_key = hs.config.signing_key[0]
self.server_name = hs.hostname
self.proxy_addr = hs.config.proxy_federation_requests_address
self.gateway_addr = hs.config.federation_request_gateway_addr
reactor = hs.get_reactor()
pool = HTTPConnectionPool(reactor)
pool.retryAutomatically = False
pool.maxPersistentPerHost = 5
pool.cachedConnectionTimeout = 2 * 60
if self.proxy_addr:
if self.gateway_addr:
self.agent = Agent.usingEndpointFactory(
reactor, ProxyMatrixFederationEndpointFactory(hs), pool=pool
)