summary refs log tree commit diff
path: root/synapse/http
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2023-03-03 14:58:21 +0000
committerDavid Robertson <davidr@element.io>2023-03-03 14:58:21 +0000
commite9eca6d8f4c4a73d1756025ecbd201ad677a50c8 (patch)
treebc3e58a825d68ffacd8c19d3326bb486de4fbaa7 /synapse/http
parentTesting: (diff)
downloadsynapse-github/dmr/restrict_outbound_federation.tar.xz
Diffstat (limited to 'synapse/http')
-rw-r--r--synapse/http/outbound_federation_proxy.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/synapse/http/outbound_federation_proxy.py b/synapse/http/outbound_federation_proxy.py
new file mode 100644

index 0000000000..1f3ed0c884 --- /dev/null +++ b/synapse/http/outbound_federation_proxy.py
@@ -0,0 +1,22 @@ +from twisted.web.http import HTTPFactory +from twisted.web.proxy import Proxy, ProxyClient, ProxyClientFactory, ProxyRequest + + +class FederationOutboundProxyClient(ProxyClient): + ... + + +class FederationOutboundProxyClientFactory(ProxyClientFactory): + protocol = FederationOutboundProxyClient + + +class FederationOutboundProxyRequest(ProxyRequest): + protocols = {b"matrix": FederationOutboundProxyClientFactory} + ports = {b"matrix": 80} + + +class FederationOutboundProxy(Proxy): + requestFactory = FederationOutboundProxyRequest + + +OutboundFederationProxyFactory = HTTPFactory.forProtocol(FederationOutboundProxy)