1
0

WIP snapshot

This commit is contained in:
David Robertson
2023-03-03 14:58:21 +00:00
parent e098fbf9d4
commit e9eca6d8f4
2 changed files with 24 additions and 2 deletions
+2 -2
View File
@@ -64,6 +64,7 @@ from synapse.events.presence_router import load_legacy_presence_router
from synapse.events.spamcheck import load_legacy_spam_checkers
from synapse.events.third_party_rules import load_legacy_third_party_event_rules
from synapse.handlers.auth import load_legacy_password_auth_providers
from synapse.http.outbound_federation_proxy import OutboundFederationProxyFactory
from synapse.http.site import SynapseSite
from synapse.logging.context import PreserveLoggingContext
from synapse.logging.opentracing import init_tracer
@@ -387,8 +388,7 @@ def listen_outbound_fed_proxy(
context_factory: Optional[IOpenSSLContextFactory],
reactor: ISynapseReactor = reactor,
) -> None:
factory = HTTPFactory.forProtocol(Proxy)
listen_http(listener_config, factory, context_factory, reactor)
listen_http(listener_config, OutboundFederationProxyFactory, context_factory, reactor)
def listen_http(
+22
View File
@@ -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)