diff options
author | Travis Ralston <travisr@matrix.org> | 2023-09-05 13:45:39 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-05 15:45:39 -0400 |
commit | b1d71c687ae55ce67e4cfc82c475e61f959dfeb0 (patch) | |
tree | 530fcaf3b4e6b9f56591d51ba4ad820fd7470262 /scripts-dev/federation_client.py | |
parent | Fix bug where we kept re-requesting a remote server's key repeatedly. (#16257) (diff) | |
download | synapse-b1d71c687ae55ce67e4cfc82c475e61f959dfeb0.tar.xz |
Add MSC4040 `matrix-fed` service lookups (#16137)
Diffstat (limited to 'scripts-dev/federation_client.py')
-rwxr-xr-x | scripts-dev/federation_client.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts-dev/federation_client.py b/scripts-dev/federation_client.py index 5ad334b4d8..e8baeac5e2 100755 --- a/scripts-dev/federation_client.py +++ b/scripts-dev/federation_client.py @@ -329,6 +329,17 @@ class MatrixConnectionAdapter(HTTPAdapter): raise ValueError("Invalid host:port '%s'" % (server_name,)) return out[0], port, out[0] + # Look up SRV for Matrix 1.8 `matrix-fed` service first + try: + srv = srvlookup.lookup("matrix-fed", "tcp", server_name)[0] + print( + f"SRV lookup on _matrix-fed._tcp.{server_name} gave {srv}", + file=sys.stderr, + ) + return srv.host, srv.port, server_name + except Exception: + pass + # Fall back to deprecated `matrix` service try: srv = srvlookup.lookup("matrix", "tcp", server_name)[0] print( @@ -337,6 +348,7 @@ class MatrixConnectionAdapter(HTTPAdapter): ) return srv.host, srv.port, server_name except Exception: + # Fall even further back to just port 8448 return server_name, 8448, server_name @staticmethod |