mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-18 17:10:43 +03:00
Clarify this is not for use with a SOCKS proxy
This commit is contained in:
parent
2c9ce72071
commit
1128d9b9b2
2 changed files with 12 additions and 10 deletions
|
@ -109,8 +109,8 @@ class ServerConfig(Config):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Optional proxy address for federation traffic
|
# Optional proxy address for federation traffic
|
||||||
self.proxy_federation_requests_address = config.get(
|
self.federation_request_gateway_addr = config.get(
|
||||||
"proxy_federation_requests_address", None
|
"federation_request_gateway_addr", None
|
||||||
)
|
)
|
||||||
|
|
||||||
# turn the whitelist into a hash for speed of lookup
|
# turn the whitelist into a hash for speed of lookup
|
||||||
|
@ -119,10 +119,10 @@ class ServerConfig(Config):
|
||||||
for domain in federation_domain_whitelist:
|
for domain in federation_domain_whitelist:
|
||||||
self.federation_domain_whitelist[domain] = True
|
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
|
# Ensure proxy address is correctly formatted
|
||||||
if len(self.proxy_federation_requests_address.split(':')) != 2:
|
if len(self.federation_request_gateway_addr.split(':')) != 2:
|
||||||
self.proxy_federation_requests_address = None
|
self.federation_request_gateway_addr = None
|
||||||
|
|
||||||
if self.public_baseurl is not None:
|
if self.public_baseurl is not None:
|
||||||
if self.public_baseurl[-1] != '/':
|
if self.public_baseurl[-1] != '/':
|
||||||
|
@ -300,8 +300,10 @@ class ServerConfig(Config):
|
||||||
# - nyc.example.com
|
# - nyc.example.com
|
||||||
# - syd.example.com
|
# - syd.example.com
|
||||||
|
|
||||||
# Proxy outbound federation requests through a seperate HTTP proxy.
|
# Send outbound federation requests through a seperate traffic gateway.
|
||||||
# proxy_federation_requests_address: localhost:1234
|
# 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
|
# List of ports that Synapse should listen on, their purpose and their
|
||||||
# configuration.
|
# configuration.
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ProxyMatrixFederationEndpointFactory(object):
|
||||||
|
|
||||||
def endpointForURI(self, uri):
|
def endpointForURI(self, uri):
|
||||||
return matrix_federation_endpoint(
|
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
|
tls_client_options_factory=None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -196,14 +196,14 @@ class MatrixFederationHttpClient(object):
|
||||||
self.hs = hs
|
self.hs = hs
|
||||||
self.signing_key = hs.config.signing_key[0]
|
self.signing_key = hs.config.signing_key[0]
|
||||||
self.server_name = hs.hostname
|
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()
|
reactor = hs.get_reactor()
|
||||||
pool = HTTPConnectionPool(reactor)
|
pool = HTTPConnectionPool(reactor)
|
||||||
pool.retryAutomatically = False
|
pool.retryAutomatically = False
|
||||||
pool.maxPersistentPerHost = 5
|
pool.maxPersistentPerHost = 5
|
||||||
pool.cachedConnectionTimeout = 2 * 60
|
pool.cachedConnectionTimeout = 2 * 60
|
||||||
|
|
||||||
if self.proxy_addr:
|
if self.gateway_addr:
|
||||||
self.agent = Agent.usingEndpointFactory(
|
self.agent = Agent.usingEndpointFactory(
|
||||||
reactor, ProxyMatrixFederationEndpointFactory(hs), pool=pool
|
reactor, ProxyMatrixFederationEndpointFactory(hs), pool=pool
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue