summary refs log tree commit diff
path: root/synapse/server.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2021-04-16 12:33:45 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2021-04-16 12:33:45 +0100
commit93db8f1992887d0e01e31331a1ee2ad030d62b87 (patch)
treea94c08060fb4e07bf37ddc97234152f144db9afb /synapse/server.py
parentPort "Allow providing credentials to HTTPS_PROXY (#9657)" from mainline (#95) (diff)
parentMerge branch 'release-v1.24.0' into develop (diff)
downloadsynapse-93db8f1992887d0e01e31331a1ee2ad030d62b87.tar.xz
Merge commit 'cf7d3c90d' into dinsic
Diffstat (limited to 'synapse/server.py')
-rw-r--r--synapse/server.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/synapse/server.py b/synapse/server.py

index 78f665a51c..54f50f59bc 100644 --- a/synapse/server.py +++ b/synapse/server.py
@@ -382,6 +382,28 @@ class HomeServer(metaclass=abc.ABCMeta): return MatrixFederationHttpClient(self, tls_client_options_factory) @cache_in_self + def get_proxied_blacklisted_http_client(self) -> SimpleHttpClient: + """ + An HTTP client that uses configured HTTP(S) proxies and blacklists IPs + based on the IP range blacklist. + """ + return SimpleHttpClient( + self, + ip_blacklist=self.config.ip_range_blacklist, + use_proxy=True, + ) + + @cache_in_self + def get_federation_http_client(self) -> MatrixFederationHttpClient: + """ + An HTTP client for federation. + """ + tls_client_options_factory = context_factory.FederationPolicyForHTTPS( + self.config + ) + return MatrixFederationHttpClient(self, tls_client_options_factory) + + @cache_in_self def get_room_creation_handler(self) -> RoomCreationHandler: return RoomCreationHandler(self)