summary refs log tree commit diff
path: root/synapse/federation
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/federation')
-rw-r--r--synapse/federation/__init__.py1
-rw-r--r--synapse/federation/handler.py1
-rw-r--r--synapse/federation/pdu_codec.py1
-rw-r--r--synapse/federation/persistence.py1
-rw-r--r--synapse/federation/replication.py1
-rw-r--r--synapse/federation/transport.py34
-rw-r--r--synapse/federation/units.py1
7 files changed, 25 insertions, 15 deletions
diff --git a/synapse/federation/__init__.py b/synapse/federation/__init__.py
index b4d95ed5ac..ac0c10dc33 100644
--- a/synapse/federation/__init__.py
+++ b/synapse/federation/__init__.py
@@ -12,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
 """ This package includes all the federation specific logic.
 """
 
diff --git a/synapse/federation/handler.py b/synapse/federation/handler.py
index 31e8470b33..d361f0aaf7 100644
--- a/synapse/federation/handler.py
+++ b/synapse/federation/handler.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
 from twisted.internet import defer
 
 from .pdu_codec import PduCodec
diff --git a/synapse/federation/pdu_codec.py b/synapse/federation/pdu_codec.py
index 9155930e47..adc166c564 100644
--- a/synapse/federation/pdu_codec.py
+++ b/synapse/federation/pdu_codec.py
@@ -12,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
 from .units import Pdu
 
 import copy
diff --git a/synapse/federation/persistence.py b/synapse/federation/persistence.py
index ad4111c683..372245712a 100644
--- a/synapse/federation/persistence.py
+++ b/synapse/federation/persistence.py
@@ -12,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
 """ This module contains all the persistence actions done by the federation
 package.
 
diff --git a/synapse/federation/replication.py b/synapse/federation/replication.py
index 0f5b974291..bea5335f89 100644
--- a/synapse/federation/replication.py
+++ b/synapse/federation/replication.py
@@ -12,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
 """This layer is responsible for replicating with remote home servers using
 a given transport.
 """
diff --git a/synapse/federation/transport.py b/synapse/federation/transport.py
index 2136adf8d7..ff3fc34419 100644
--- a/synapse/federation/transport.py
+++ b/synapse/federation/transport.py
@@ -12,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
 """The transport layer is responsible for both sending transactions to remote
 home servers and receiving a variety of requests from other home servers.
 
@@ -32,6 +33,9 @@ import re
 logger = logging.getLogger(__name__)
 
 
+PREFIX = "/matrix/federation/v1"
+
+
 class TransportLayer(object):
     """This is a basic implementation of the transport layer that translates
     transactions and other requests to/from HTTP.
@@ -83,9 +87,9 @@ class TransportLayer(object):
         logger.debug("get_context_state dest=%s, context=%s",
                      destination, context)
 
-        path = "/state/%s/" % context
+        subpath = "/state/%s/" % context
 
-        return self._do_request_for_transaction(destination, path)
+        return self._do_request_for_transaction(destination, subpath)
 
     @log_function
     def get_pdu(self, destination, pdu_origin, pdu_id):
@@ -103,9 +107,9 @@ class TransportLayer(object):
         logger.debug("get_pdu dest=%s, pdu_origin=%s, pdu_id=%s",
                      destination, pdu_origin, pdu_id)
 
-        path = "/pdu/%s/%s/" % (pdu_origin, pdu_id)
+        subpath = "/pdu/%s/%s/" % (pdu_origin, pdu_id)
 
-        return self._do_request_for_transaction(destination, path)
+        return self._do_request_for_transaction(destination, subpath)
 
     @log_function
     def paginate(self, dest, context, pdu_tuples, limit):
@@ -129,14 +133,14 @@ class TransportLayer(object):
         if not pdu_tuples:
             return
 
-        path = "/paginate/%s/" % context
+        subpath = "/paginate/%s/" % context
 
         args = {"v": ["%s,%s" % (i, o) for i, o in pdu_tuples]}
         args["limit"] = limit
 
         return self._do_request_for_transaction(
             dest,
-            path,
+            subpath,
             args=args,
         )
 
@@ -165,7 +169,7 @@ class TransportLayer(object):
 
         code, response = yield self.client.put_json(
             transaction.destination,
-            path="/send/%s/" % transaction.transaction_id,
+            path=PREFIX + "/send/%s/" % transaction.transaction_id,
             data=data
         )
 
@@ -188,7 +192,7 @@ class TransportLayer(object):
         # This is when someone is trying to send us a bunch of data.
         self.server.register_path(
             "PUT",
-            re.compile("^/send/([^/]*)/$"),
+            re.compile("^" + PREFIX + "/send/([^/]*)/$"),
             self._on_send_request
         )
 
@@ -206,7 +210,7 @@ class TransportLayer(object):
         # This is for when someone asks us for everything since version X
         self.server.register_path(
             "GET",
-            re.compile("^/pull/$"),
+            re.compile("^" + PREFIX + "/pull/$"),
             lambda request: handler.on_pull_request(
                 request.args["origin"][0],
                 request.args["v"]
@@ -217,7 +221,7 @@ class TransportLayer(object):
         # data_id pair.
         self.server.register_path(
             "GET",
-            re.compile("^/pdu/([^/]*)/([^/]*)/$"),
+            re.compile("^" + PREFIX + "/pdu/([^/]*)/([^/]*)/$"),
             lambda request, pdu_origin, pdu_id: handler.on_pdu_request(
                 pdu_origin, pdu_id
             )
@@ -226,7 +230,7 @@ class TransportLayer(object):
         # This is when someone asks for all data for a given context.
         self.server.register_path(
             "GET",
-            re.compile("^/state/([^/]*)/$"),
+            re.compile("^" + PREFIX + "/state/([^/]*)/$"),
             lambda request, context: handler.on_context_state_request(
                 context
             )
@@ -234,7 +238,7 @@ class TransportLayer(object):
 
         self.server.register_path(
             "GET",
-            re.compile("^/paginate/([^/]*)/$"),
+            re.compile("^" + PREFIX + "/paginate/([^/]*)/$"),
             lambda request, context: self._on_paginate_request(
                 context, request.args["v"],
                 request.args["limit"]
@@ -243,7 +247,7 @@ class TransportLayer(object):
 
         self.server.register_path(
             "GET",
-            re.compile("^/context/([^/]*)/$"),
+            re.compile("^" + PREFIX + "/context/([^/]*)/$"),
             lambda request, context: handler.on_context_pdus_request(context)
         )
 
@@ -299,7 +303,7 @@ class TransportLayer(object):
 
     @defer.inlineCallbacks
     @log_function
-    def _do_request_for_transaction(self, destination, path, args={}):
+    def _do_request_for_transaction(self, destination, subpath, args={}):
         """
         Args:
             destination (str)
@@ -312,7 +316,7 @@ class TransportLayer(object):
 
         data = yield self.client.get_json(
             destination,
-            path=path,
+            path=PREFIX + subpath,
             args=args,
         )
 
diff --git a/synapse/federation/units.py b/synapse/federation/units.py
index 0efea7b768..2b2f11f36a 100644
--- a/synapse/federation/units.py
+++ b/synapse/federation/units.py
@@ -12,6 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
 """ Defines the JSON structure of the protocol units used by the server to
 server protocol.
 """