Browse Source

Merge remote-tracking branch 'upstream/master' into pushers

merge-requests/18/head
Devin Ragotzy 5 years ago
parent
commit
4ce40b18a5
  1. 15
      .gitlab/issue_templates/Issue Template.md
  2. 471
      Cargo.lock
  3. 32
      Cargo.toml
  4. 4
      conduit-example.toml
  5. 2
      src/appservice_server.rs
  6. 5
      src/client_server/account.rs
  7. 14
      src/client_server/alias.rs
  8. 14
      src/client_server/backup.rs
  9. 1
      src/client_server/capabilities.rs
  10. 2
      src/client_server/config.rs
  11. 1
      src/client_server/context.rs
  12. 5
      src/client_server/device.rs
  13. 4
      src/client_server/directory.rs
  14. 2
      src/client_server/filter.rs
  15. 6
      src/client_server/keys.rs
  16. 4
      src/client_server/media.rs
  17. 11
      src/client_server/membership.rs
  18. 2
      src/client_server/message.rs
  19. 1
      src/client_server/mod.rs
  20. 1
      src/client_server/presence.rs
  21. 5
      src/client_server/profile.rs
  22. 10
      src/client_server/push.rs
  23. 53
      src/client_server/read_marker.rs
  24. 1
      src/client_server/redact.rs
  25. 3
      src/client_server/room.rs
  26. 1
      src/client_server/search.rs
  27. 7
      src/client_server/session.rs
  28. 5
      src/client_server/state.rs
  29. 5
      src/client_server/sync.rs
  30. 3
      src/client_server/tag.rs
  31. 1
      src/client_server/thirdparty.rs
  32. 1
      src/client_server/to_device.rs
  33. 1
      src/client_server/typing.rs
  34. 1
      src/client_server/unversioned.rs
  35. 1
      src/client_server/user_directory.rs
  36. 1
      src/client_server/voip.rs
  37. 2
      src/database.rs
  38. 1
      src/database/account_data.rs
  39. 3
      src/database/admin.rs
  40. 3
      src/database/globals.rs
  41. 26
      src/database/rooms.rs
  42. 5
      src/database/rooms/edus.rs
  43. 84
      src/database/sending.rs
  44. 5
      src/database/users.rs
  45. 72
      src/error.rs
  46. 2
      src/lib.rs
  47. 66
      src/main.rs
  48. 34
      src/pdu.rs
  49. 4
      src/ruma_wrapper.rs
  50. 87
      src/server_server.rs
  51. 1
      src/utils.rs
  52. 2
      tests/Complement.Dockerfile
  53. 78
      tests/sytest/are-we-synapse-yet.list
  54. 28
      tests/sytest/are-we-synapse-yet.py

15
.gitlab/issue_templates/Issue Template.md

@ -0,0 +1,15 @@
# Headline
### Description
/label ~conduit

471
Cargo.lock generated

@ -15,6 +15,15 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "arrayref" name = "arrayref"
version = "0.3.6" version = "0.3.6"
@ -113,15 +122,15 @@ dependencies = [
[[package]] [[package]]
name = "bumpalo" name = "bumpalo"
version = "3.6.0" version = "3.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9" checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe"
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
version = "1.5.0" version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a4bad0c5981acc24bc09e532f35160f952e35422603f0563cd7a73c2c2e65a0" checksum = "bed57e2090563b83ba8f83366628ce535a7584c9afa4c9fc0612a03925c6df58"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
@ -137,9 +146,9 @@ checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.66" version = "1.0.67"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -176,7 +185,9 @@ dependencies = [
"image", "image",
"jsonwebtoken", "jsonwebtoken",
"log", "log",
"rand 0.7.3", "opentelemetry",
"opentelemetry-jaeger",
"rand",
"regex", "regex",
"reqwest", "reqwest",
"ring", "ring",
@ -190,6 +201,9 @@ dependencies = [
"state-res", "state-res",
"thiserror", "thiserror",
"tokio", "tokio",
"tracing",
"tracing-opentelemetry",
"tracing-subscriber",
"trust-dns-resolver", "trust-dns-resolver",
] ]
@ -242,12 +256,11 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-epoch" name = "crossbeam-epoch"
version = "0.9.1" version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d" checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"const_fn",
"crossbeam-utils", "crossbeam-utils",
"lazy_static", "lazy_static",
"memoffset", "memoffset",
@ -256,9 +269,9 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.1" version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cfg-if", "cfg-if",
@ -372,10 +385,11 @@ dependencies = [
[[package]] [[package]]
name = "figment" name = "figment"
version = "0.10.2" version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3add2ec7727c9584a0ce75ee3c0f54f0ab692c7934450cc3a0287251e3a4f06" checksum = "c38799b106530aa30f774f7fca6d8f7e5f6234a79f427c4fad3c975eaf678931"
dependencies = [ dependencies = [
"atomic",
"pear", "pear",
"serde", "serde",
"toml", "toml",
@ -406,9 +420,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]] [[package]]
name = "form_urlencoded" name = "form_urlencoded"
version = "1.0.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
dependencies = [ dependencies = [
"matches", "matches",
"percent-encoding", "percent-encoding",
@ -426,9 +440,9 @@ dependencies = [
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.12" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da9052a1a50244d8d5aa9bf55cbc2fb6f357c86cc52e46c62ed390a7180cf150" checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -441,9 +455,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.12" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -451,15 +465,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.12" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94"
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.12" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9" checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@ -468,15 +482,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.12" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28be053525281ad8259d47e4de5de657b25e7bac113458555bb4b70bc6870500" checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59"
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.12" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7"
dependencies = [ dependencies = [
"proc-macro-hack", "proc-macro-hack",
"proc-macro2", "proc-macro2",
@ -486,24 +500,21 @@ dependencies = [
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.12" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.12" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80"
dependencies = [
"once_cell",
]
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.12" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -568,9 +579,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]] [[package]]
name = "h2" name = "h2"
version = "0.3.0" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b67e66362108efccd8ac053abafc8b7a8d86a37e6e48fc4f6f7485eb5e9e6a5" checksum = "d832b01df74254fe364568d6ddc294443f61cbec82816b60904303af87efae78"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@ -583,7 +594,6 @@ dependencies = [
"tokio", "tokio",
"tokio-util", "tokio-util",
"tracing", "tracing",
"tracing-futures",
] ]
[[package]] [[package]]
@ -670,7 +680,7 @@ dependencies = [
"httparse", "httparse",
"httpdate", "httpdate",
"itoa", "itoa",
"pin-project 1.0.5", "pin-project",
"socket2", "socket2",
"tokio", "tokio",
"tower-service", "tower-service",
@ -693,9 +703,9 @@ dependencies = [
[[package]] [[package]]
name = "idna" name = "idna"
version = "0.2.1" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de910d521f7cc3135c4de8db1cb910e0b5ed1dc6f57c381cd07e8e661ce10094" checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21"
dependencies = [ dependencies = [
"matches", "matches",
"unicode-bidi", "unicode-bidi",
@ -704,9 +714,9 @@ dependencies = [
[[package]] [[package]]
name = "image" name = "image"
version = "0.23.13" version = "0.23.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "293f07a1875fa7e9c5897b51aa68b2d8ed8271b87e1a44cb64b9c3d98aabbc0d" checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"byteorder", "byteorder",
@ -744,6 +754,12 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "integer-encoding"
version = "1.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48dc51180a9b377fd75814d0cc02199c20f8e99433d6762f650d39cdbbd3b56f"
[[package]] [[package]]
name = "ipconfig" name = "ipconfig"
version = "0.2.2" version = "0.2.2"
@ -785,9 +801,9 @@ checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.47" version = "0.3.48"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
@ -823,9 +839,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.86" version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c" checksum = "265d751d31d6780a3f956bb5b8022feba2d94eeee5a84ba64f4212eedca42213"
[[package]] [[package]]
name = "linked-hash-map" name = "linked-hash-map"
@ -872,6 +888,15 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4"
[[package]]
name = "matchers"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1"
dependencies = [
"regex-automata",
]
[[package]] [[package]]
name = "matches" name = "matches"
version = "0.1.8" version = "0.1.8"
@ -910,9 +935,9 @@ dependencies = [
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.7.7" version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7" checksum = "a5dede4e2065b3842b8b0af444119f3aa331cc7cc2dd20388bfb0f5d5a38823a"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
@ -1022,9 +1047,9 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.5.2" version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
[[package]] [[package]]
name = "openssl" name = "openssl"
@ -1048,9 +1073,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
[[package]] [[package]]
name = "openssl-src" name = "openssl-src"
version = "111.13.0+1.1.1i" version = "111.14.0+1.1.1j"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "045e4dc48af57aad93d665885789b43222ae26f4886494da12d1ed58d309dcb6" checksum = "055b569b5bd7e5462a1700f595c7c7d487691d73b5ce064176af7f9f0cbb80a9"
dependencies = [ dependencies = [
"cc", "cc",
] ]
@ -1069,6 +1094,44 @@ dependencies = [
"vcpkg", "vcpkg",
] ]
[[package]]
name = "opentelemetry"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "514d24875c140ed269eecc2d1b56d7b71b573716922a763c317fb1b1b4b58f15"
dependencies = [
"async-trait",
"futures",
"js-sys",
"lazy_static",
"percent-encoding",
"pin-project",
"rand",
"thiserror",
]
[[package]]
name = "opentelemetry-jaeger"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5677b3a361784aff6e2b1b30dbdb5f85f4ec57ff2ced41d9a481ad70a9d0b57"
dependencies = [
"async-trait",
"lazy_static",
"opentelemetry",
"thiserror",
"thrift",
]
[[package]]
name = "ordered-float"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7"
dependencies = [
"num-traits",
]
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.11.1" version = "0.11.1"
@ -1082,14 +1145,14 @@ dependencies = [
[[package]] [[package]]
name = "parking_lot_core" name = "parking_lot_core"
version = "0.8.2" version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272" checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"instant", "instant",
"libc", "libc",
"redox_syscall 0.1.57", "redox_syscall 0.2.5",
"smallvec", "smallvec",
"winapi", "winapi",
] ]
@ -1102,9 +1165,9 @@ checksum = "c5d65c4d95931acda4498f675e332fcbdc9a06705cd07086c510e9b6009cd1c1"
[[package]] [[package]]
name = "pear" name = "pear"
version = "0.2.0" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09f612cbd0f9dd03f5dd28a191c48e4148c3b027e41207b32eee130373c6c941" checksum = "86ab3a2b792945ed67eadbbdcbd2898f8dd2319392b2a45ac21adea5245cb113"
dependencies = [ dependencies = [
"inlinable_string", "inlinable_string",
"pear_codegen", "pear_codegen",
@ -1113,9 +1176,9 @@ dependencies = [
[[package]] [[package]]
name = "pear_codegen" name = "pear_codegen"
version = "0.2.0" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "602cf1780ee9bbca663ea75769e05643e16fe87d7c8ac9f4f385a2ed8940a75c" checksum = "620c9c4776ba41b59ab101360c9b1419c0c8c81cd2e6e39fae7109e7425994cb"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"proc-macro2-diagnostics", "proc-macro2-diagnostics",
@ -1125,9 +1188,9 @@ dependencies = [
[[package]] [[package]]
name = "pem" name = "pem"
version = "0.8.2" version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c220d01f863d13d96ca82359d1e81e64a7c6bf0637bcde7b2349630addf0c6" checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb"
dependencies = [ dependencies = [
"base64 0.13.0", "base64 0.13.0",
"once_cell", "once_cell",
@ -1140,33 +1203,13 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "pin-project"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15"
dependencies = [
"pin-project-internal 0.4.27",
]
[[package]] [[package]]
name = "pin-project" name = "pin-project"
version = "1.0.5" version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63" checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63"
dependencies = [ dependencies = [
"pin-project-internal 1.0.5", "pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895"
dependencies = [
"proc-macro2",
"quote",
"syn",
] ]
[[package]] [[package]]
@ -1182,9 +1225,9 @@ dependencies = [
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.4" version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" checksum = "0cf491442e4b033ed1c722cb9f0df5fcfcf4de682466c46469c36bc47dc5548a"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
@ -1267,26 +1310,13 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.8" version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "rand"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom 0.1.16",
"libc",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"rand_hc 0.2.0",
]
[[package]] [[package]]
name = "rand" name = "rand"
version = "0.8.3" version = "0.8.3"
@ -1294,19 +1324,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
dependencies = [ dependencies = [
"libc", "libc",
"rand_chacha 0.3.0", "rand_chacha",
"rand_core 0.6.1", "rand_core",
"rand_hc 0.3.0", "rand_hc",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core 0.5.1",
] ]
[[package]] [[package]]
@ -1316,43 +1336,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
dependencies = [ dependencies = [
"ppv-lite86", "ppv-lite86",
"rand_core 0.6.1", "rand_core",
]
[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom 0.1.16",
] ]
[[package]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.6.1" version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
dependencies = [ dependencies = [
"getrandom 0.2.2", "getrandom 0.2.2",
] ]
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core 0.5.1",
]
[[package]] [[package]]
name = "rand_hc" name = "rand_hc"
version = "0.3.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
dependencies = [ dependencies = [
"rand_core 0.6.1", "rand_core",
] ]
[[package]] [[package]]
@ -1363,9 +1365,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.2.4" version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9"
dependencies = [ dependencies = [
"bitflags", "bitflags",
] ]
@ -1413,6 +1415,16 @@ dependencies = [
"thread_local", "thread_local",
] ]
[[package]]
name = "regex-automata"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4"
dependencies = [
"byteorder",
"regex-syntax",
]
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.22" version = "0.6.22"
@ -1430,9 +1442,9 @@ dependencies = [
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.11.0" version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd281b1030aa675fb90aa994d07187645bb3c8fc756ca766e7c3070b439de9de" checksum = "0460542b551950620a3648c6aa23318ac6b3cd779114bd873209e6e8b5eb1c34"
dependencies = [ dependencies = [
"base64 0.13.0", "base64 0.13.0",
"bytes", "bytes",
@ -1490,7 +1502,7 @@ dependencies = [
[[package]] [[package]]
name = "rocket" name = "rocket"
version = "0.5.0-dev" version = "0.5.0-dev"
source = "git+https://github.com/SergioBenitez/Rocket.git?rev=c24f15c18f02319be83af4f3c1951dc220b52c5e#c24f15c18f02319be83af4f3c1951dc220b52c5e" source = "git+https://github.com/SergioBenitez/Rocket.git?rev=93e62c86eddf7cc9a7fc40b044182f83f0d7d92a#93e62c86eddf7cc9a7fc40b044182f83f0d7d92a"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"atomic", "atomic",
@ -1503,7 +1515,7 @@ dependencies = [
"memchr", "memchr",
"num_cpus", "num_cpus",
"parking_lot", "parking_lot",
"rand 0.7.3", "rand",
"ref-cast", "ref-cast",
"rocket_codegen", "rocket_codegen",
"rocket_http", "rocket_http",
@ -1519,7 +1531,7 @@ dependencies = [
[[package]] [[package]]
name = "rocket_codegen" name = "rocket_codegen"
version = "0.5.0-dev" version = "0.5.0-dev"
source = "git+https://github.com/SergioBenitez/Rocket.git?rev=c24f15c18f02319be83af4f3c1951dc220b52c5e#c24f15c18f02319be83af4f3c1951dc220b52c5e" source = "git+https://github.com/SergioBenitez/Rocket.git?rev=93e62c86eddf7cc9a7fc40b044182f83f0d7d92a#93e62c86eddf7cc9a7fc40b044182f83f0d7d92a"
dependencies = [ dependencies = [
"devise", "devise",
"glob", "glob",
@ -1531,7 +1543,7 @@ dependencies = [
[[package]] [[package]]
name = "rocket_http" name = "rocket_http"
version = "0.5.0-dev" version = "0.5.0-dev"
source = "git+https://github.com/SergioBenitez/Rocket.git?rev=c24f15c18f02319be83af4f3c1951dc220b52c5e#c24f15c18f02319be83af4f3c1951dc220b52c5e" source = "git+https://github.com/SergioBenitez/Rocket.git?rev=93e62c86eddf7cc9a7fc40b044182f83f0d7d92a#93e62c86eddf7cc9a7fc40b044182f83f0d7d92a"
dependencies = [ dependencies = [
"cookie", "cookie",
"either", "either",
@ -1693,7 +1705,7 @@ version = "0.18.0-alpha.1"
source = "git+https://github.com/ruma/ruma?rev=0a10afe6dacc2b7a50a8002c953d10b7fb4e37bc#0a10afe6dacc2b7a50a8002c953d10b7fb4e37bc" source = "git+https://github.com/ruma/ruma?rev=0a10afe6dacc2b7a50a8002c953d10b7fb4e37bc#0a10afe6dacc2b7a50a8002c953d10b7fb4e37bc"
dependencies = [ dependencies = [
"paste", "paste",
"rand 0.8.3", "rand",
"ruma-identifiers-macros", "ruma-identifiers-macros",
"ruma-identifiers-validation", "ruma-identifiers-validation",
"ruma-serde", "ruma-serde",
@ -1850,9 +1862,9 @@ dependencies = [
[[package]] [[package]]
name = "security-framework" name = "security-framework"
version = "2.0.0" version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" checksum = "2dfd318104249865096c8da1dfabf09ddbb6d0330ea176812a62ec75e40c4166"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"core-foundation", "core-foundation",
@ -1863,9 +1875,9 @@ dependencies = [
[[package]] [[package]]
name = "security-framework-sys" name = "security-framework-sys"
version = "2.0.0" version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" checksum = "dee48cdde5ed250b0d3252818f646e174ab414036edb884dde62d80a3ac6082d"
dependencies = [ dependencies = [
"core-foundation-sys", "core-foundation-sys",
"libc", "libc",
@ -1908,9 +1920,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.62" version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486" checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -1931,9 +1943,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_yaml" name = "serde_yaml"
version = "0.8.16" version = "0.8.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdd2af560da3c1fdc02cb80965289254fc35dff869810061e2d8290ee48848ae" checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23"
dependencies = [ dependencies = [
"dtoa", "dtoa",
"linked-hash-map", "linked-hash-map",
@ -1947,6 +1959,15 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
[[package]]
name = "sharded-slab"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79c719719ee05df97490f80a45acfc99e5a30ce98a1e4fb67aee422745ae14e3"
dependencies = [
"lazy_static",
]
[[package]] [[package]]
name = "signal-hook-registry" name = "signal-hook-registry"
version = "1.3.0" version = "1.3.0"
@ -2109,26 +2130,26 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"rand 0.8.3", "rand",
"redox_syscall 0.2.4", "redox_syscall 0.2.5",
"remove_dir_all", "remove_dir_all",
"winapi", "winapi",
] ]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.23" version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.23" version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2144,6 +2165,28 @@ dependencies = [
"once_cell", "once_cell",
] ]
[[package]]
name = "threadpool"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa"
dependencies = [
"num_cpus",
]
[[package]]
name = "thrift"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c6d965454947cc7266d22716ebfd07b18d84ebaf35eec558586bbb2a8cb6b5b"
dependencies = [
"byteorder",
"integer-encoding",
"log",
"ordered-float",
"threadpool",
]
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.43" version = "0.1.43"
@ -2289,15 +2332,27 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
[[package]] [[package]]
name = "tracing" name = "tracing"
version = "0.1.23" version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d40a22fd029e33300d8d89a5cc8ffce18bb7c587662f54629e94c9de5487f3" checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"pin-project-lite", "pin-project-lite",
"tracing-attributes",
"tracing-core", "tracing-core",
] ]
[[package]]
name = "tracing-attributes"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8a9bd1db7706f2373a190b0d067146caa39350c486f3d455b0e33b431f94c07"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "tracing-core" name = "tracing-core"
version = "0.1.17" version = "0.1.17"
@ -2308,13 +2363,59 @@ dependencies = [
] ]
[[package]] [[package]]
name = "tracing-futures" name = "tracing-log"
version = "0.2.4" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3"
dependencies = [
"lazy_static",
"log",
"tracing-core",
]
[[package]]
name = "tracing-opentelemetry"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" checksum = "cccdf13c28f1654fe806838f28c5b9cb23ca4c0eae71450daa489f50e523ceb1"
dependencies = [ dependencies = [
"pin-project 0.4.27", "opentelemetry",
"tracing", "tracing",
"tracing-core",
"tracing-log",
"tracing-subscriber",
]
[[package]]
name = "tracing-serde"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b"
dependencies = [
"serde",
"tracing-core",
]
[[package]]
name = "tracing-subscriber"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ab8966ac3ca27126141f7999361cc97dd6fb4b71da04c02044fa9045d98bb96"
dependencies = [
"ansi_term",
"chrono",
"lazy_static",
"matchers",
"regex",
"serde",
"serde_json",
"sharded-slab",
"smallvec",
"thread_local",
"tracing",
"tracing-core",
"tracing-log",
"tracing-serde",
] ]
[[package]] [[package]]
@ -2334,7 +2435,7 @@ dependencies = [
"ipnet", "ipnet",
"lazy_static", "lazy_static",
"log", "log",
"rand 0.8.3", "rand",
"smallvec", "smallvec",
"thiserror", "thiserror",
"tokio", "tokio",
@ -2378,9 +2479,9 @@ dependencies = [
[[package]] [[package]]
name = "uncased" name = "uncased"
version = "0.9.3" version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "369fa7fd7969c5373541d3c9a40dc1b76ce676fc87aba30d87c0ad3b97fad179" checksum = "300932469d646d39929ffe84ad5c1837beecf602519ef5695e485b472de4082b"
dependencies = [ dependencies = [
"version_check", "version_check",
] ]
@ -2423,9 +2524,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]] [[package]]
name = "url" name = "url"
version = "2.2.0" version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"idna", "idna",
@ -2469,9 +2570,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.70" version = "0.2.71"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"serde", "serde",
@ -2481,9 +2582,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.70" version = "0.2.71"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"lazy_static", "lazy_static",
@ -2496,9 +2597,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-futures" name = "wasm-bindgen-futures"
version = "0.4.20" version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3de431a2910c86679c34283a33f66f4e4abd7e0aec27b6669060148872aadf94" checksum = "8e67a5806118af01f0d9045915676b22aaebecf4178ae7021bc171dab0b897ab"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"js-sys", "js-sys",
@ -2508,9 +2609,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.70" version = "0.2.71"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@ -2518,9 +2619,9 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.70" version = "0.2.71"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2531,15 +2632,15 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.70" version = "0.2.71"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1"
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.47" version = "0.3.48"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",

32
Cargo.toml

@ -14,7 +14,7 @@ edition = "2018"
[dependencies] [dependencies]
# Used to handle requests # Used to handle requests
# TODO: This can become optional as soon as proper configs are supported # TODO: This can become optional as soon as proper configs are supported
rocket = { git = "https://github.com/SergioBenitez/Rocket.git", rev = "c24f15c18f02319be83af4f3c1951dc220b52c5e", features = ["tls"] } # Used to handle requests rocket = { git = "https://github.com/SergioBenitez/Rocket.git", rev = "93e62c86eddf7cc9a7fc40b044182f83f0d7d92a", features = ["tls"] } # Used to handle requests
#rocket = { git = "https://github.com/timokoesters/Rocket.git", branch = "empty_parameters", default-features = false, features = ["tls"] } #rocket = { git = "https://github.com/timokoesters/Rocket.git", branch = "empty_parameters", default-features = false, features = ["tls"] }
# Used for matrix spec type definitions and helpers # Used for matrix spec type definitions and helpers
@ -27,41 +27,47 @@ ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "appservice-a
state-res = { git = "https://github.com/ruma/state-res", rev = "d34a78c5b66de419862d9e592bde8e0007111ebd", features = ["unstable-pre-spec", "gen-eventid"] }#state-res = { path = "../state-res", features = ["unstable-pre-spec", "gen-eventid"] } state-res = { git = "https://github.com/ruma/state-res", rev = "d34a78c5b66de419862d9e592bde8e0007111ebd", features = ["unstable-pre-spec", "gen-eventid"] }#state-res = { path = "../state-res", features = ["unstable-pre-spec", "gen-eventid"] }
# Used for long polling and federation sender, should be the same as rocket::tokio # Used for long polling and federation sender, should be the same as rocket::tokio
tokio = { version = "1.1.0", features = ["macros", "time", "sync"] } tokio = "1.2.0"
# Used for storing data permanently # Used for storing data permanently
sled = { version = "0.34.6", default-features = false } sled = { version = "0.34.6", default-features = false }
# Used for emitting log entries # Used for emitting log entries
log = "0.4.11" log = "0.4.14"
# Used for rocket<->ruma conversions # Used for rocket<->ruma conversions
http = "0.2.1" http = "0.2.3"
# Used to find data directory for default db path # Used to find data directory for default db path
directories = "3.0.1" directories = "3.0.1"
# Used for ruma wrapper # Used for ruma wrapper
serde_json = { version = "1.0.60", features = ["raw_value"] } serde_json = { version = "1.0.64", features = ["raw_value"] }
# Used for appservice registration files # Used for appservice registration files
serde_yaml = "0.8.14" serde_yaml = "0.8.17"
# Used for pdu definition # Used for pdu definition
serde = "1.0.117" serde = "1.0.123"
# Used for secure identifiers # Used for secure identifiers
rand = "0.7.3" rand = "0.8.3"
# Used to hash passwords # Used to hash passwords
rust-argon2 = "0.8.3" rust-argon2 = "0.8.3"
# Used to send requests # Used to send requests
reqwest = "0.11.0" reqwest = "0.11.1"
# Used for conduit::Error type # Used for conduit::Error type
thiserror = "1.0.23" thiserror = "1.0.24"
# Used to generate thumbnails for images # Used to generate thumbnails for images
image = { version = "0.23.12", default-features = false, features = ["jpeg", "png", "gif"] } image = { version = "0.23.14", default-features = false, features = ["jpeg", "png", "gif"] }
# Used to encode server public key # Used to encode server public key
base64 = "0.13.0" base64 = "0.13.0"
# Used when hashing the state # Used when hashing the state
ring = "0.16.19" ring = "0.16.20"
# Used when querying the SRV record of other servers # Used when querying the SRV record of other servers
trust-dns-resolver = "0.20.0" trust-dns-resolver = "0.20.0"
# Used to find matching events for appservices # Used to find matching events for appservices
regex = "1.4.2" regex = "1.4.3"
# jwt jsonwebtokens # jwt jsonwebtokens
jsonwebtoken = "7.2.0" jsonwebtoken = "7.2.0"
# Performance measurements
tracing = "0.1.25"
opentelemetry = "0.12.0"
tracing-subscriber = "0.2.16"
tracing-opentelemetry = "0.11.0"
opentelemetry-jaeger = "0.11.0"
[features] [features]
default = ["conduit_bin"] default = ["conduit_bin"]

4
conduit-example.toml

@ -28,8 +28,12 @@ max_request_size = 20_000_000 # in bytes
# Disable encryption, so no new encrypted rooms can be created # Disable encryption, so no new encrypted rooms can be created
# Note: existing rooms will continue to work # Note: existing rooms will continue to work
#allow_encryption = true #allow_encryption = true
#allow_federation = false #allow_federation = false
# Enable jaeger to support monitoring and troubleshooting through jaeger
#allow_jaeger = false
#cache_capacity = 1073741824 # in bytes, 1024 * 1024 * 1024 #cache_capacity = 1073741824 # in bytes, 1024 * 1024 * 1024
#max_concurrent_requests = 4 # How many requests Conduit sends to other servers at the same time #max_concurrent_requests = 4 # How many requests Conduit sends to other servers at the same time
#workers = 4 # default: cpu core count * 2 #workers = 4 # default: cpu core count * 2

2
src/appservice_server.rs

@ -25,7 +25,7 @@ where
let mut parts = http_request.uri().clone().into_parts(); let mut parts = http_request.uri().clone().into_parts();
let old_path_and_query = parts.path_and_query.unwrap().as_str().to_owned(); let old_path_and_query = parts.path_and_query.unwrap().as_str().to_owned();
let symbol = if old_path_and_query.contains("?") { let symbol = if old_path_and_query.contains('?') {
"&" "&"
} else { } else {
"?" "?"

5
src/client_server/account.rs

@ -40,6 +40,7 @@ const GUEST_NAME_LENGTH: usize = 10;
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/register/available", data = "<body>") get("/_matrix/client/r0/register/available", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_register_available_route( pub async fn get_register_available_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_username_availability::Request<'_>>, body: Ruma<get_username_availability::Request<'_>>,
@ -82,6 +83,7 @@ pub async fn get_register_available_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/register", data = "<body>") post("/_matrix/client/r0/register", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn register_route( pub async fn register_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<register::Request<'_>>, body: Ruma<register::Request<'_>>,
@ -498,6 +500,7 @@ pub async fn register_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/account/password", data = "<body>") post("/_matrix/client/r0/account/password", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn change_password_route( pub async fn change_password_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<change_password::Request<'_>>, body: Ruma<change_password::Request<'_>>,
@ -562,6 +565,7 @@ pub async fn change_password_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/account/whoami", data = "<body>") get("/_matrix/client/r0/account/whoami", data = "<body>")
)] )]
#[tracing::instrument(skip(body))]
pub async fn whoami_route(body: Ruma<whoami::Request>) -> ConduitResult<whoami::Response> { pub async fn whoami_route(body: Ruma<whoami::Request>) -> ConduitResult<whoami::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
Ok(whoami::Response { Ok(whoami::Response {
@ -582,6 +586,7 @@ pub async fn whoami_route(body: Ruma<whoami::Request>) -> ConduitResult<whoami::
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/account/deactivate", data = "<body>") post("/_matrix/client/r0/account/deactivate", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn deactivate_route( pub async fn deactivate_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<deactivate::Request<'_>>, body: Ruma<deactivate::Request<'_>>,

14
src/client_server/alias.rs

@ -1,5 +1,6 @@
use super::State; use super::State;
use crate::{ConduitResult, Database, Error, Ruma}; use crate::{ConduitResult, Database, Error, Ruma};
use regex::Regex;
use ruma::{ use ruma::{
api::{ api::{
appservice, appservice,
@ -19,6 +20,7 @@ use rocket::{delete, get, put};
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/directory/room/<_>", data = "<body>") put("/_matrix/client/r0/directory/room/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn create_alias_route( pub async fn create_alias_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<create_alias::Request<'_>>, body: Ruma<create_alias::Request<'_>>,
@ -39,6 +41,7 @@ pub async fn create_alias_route(
feature = "conduit_bin", feature = "conduit_bin",
delete("/_matrix/client/r0/directory/room/<_>", data = "<body>") delete("/_matrix/client/r0/directory/room/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn delete_alias_route( pub async fn delete_alias_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_alias::Request<'_>>, body: Ruma<delete_alias::Request<'_>>,
@ -54,6 +57,7 @@ pub async fn delete_alias_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/directory/room/<_>", data = "<body>") get("/_matrix/client/r0/directory/room/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_alias_route( pub async fn get_alias_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_alias::Request<'_>>, body: Ruma<get_alias::Request<'_>>,
@ -83,7 +87,15 @@ pub async fn get_alias_helper(
Some(r) => room_id = Some(r), Some(r) => room_id = Some(r),
None => { None => {
for (_id, registration) in db.appservice.iter_all().filter_map(|r| r.ok()) { for (_id, registration) in db.appservice.iter_all().filter_map(|r| r.ok()) {
if db let aliases = registration
.get("namespaces")
.and_then(|ns| ns.get("aliases"))
.and_then(|users| users.get("regex"))
.and_then(|regex| regex.as_str())
.and_then(|regex| Regex::new(regex).ok());
if aliases.map_or(false, |aliases| aliases.is_match(room_alias.as_str()))
&& db
.sending .sending
.send_appservice_request( .send_appservice_request(
&db.globals, &db.globals,

14
src/client_server/backup.rs

@ -17,6 +17,7 @@ use rocket::{delete, get, post, put};
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/unstable/room_keys/version", data = "<body>") post("/_matrix/client/unstable/room_keys/version", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn create_backup_route( pub async fn create_backup_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<create_backup::Request>, body: Ruma<create_backup::Request>,
@ -35,6 +36,7 @@ pub async fn create_backup_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/unstable/room_keys/version/<_>", data = "<body>") put("/_matrix/client/unstable/room_keys/version/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn update_backup_route( pub async fn update_backup_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<update_backup::Request<'_>>, body: Ruma<update_backup::Request<'_>>,
@ -52,6 +54,7 @@ pub async fn update_backup_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/unstable/room_keys/version", data = "<body>") get("/_matrix/client/unstable/room_keys/version", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_latest_backup_route( pub async fn get_latest_backup_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_latest_backup::Request>, body: Ruma<get_latest_backup::Request>,
@ -79,6 +82,7 @@ pub async fn get_latest_backup_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/unstable/room_keys/version/<_>", data = "<body>") get("/_matrix/client/unstable/room_keys/version/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_backup_route( pub async fn get_backup_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_backup::Request<'_>>, body: Ruma<get_backup::Request<'_>>,
@ -105,6 +109,7 @@ pub async fn get_backup_route(
feature = "conduit_bin", feature = "conduit_bin",
delete("/_matrix/client/unstable/room_keys/version/<_>", data = "<body>") delete("/_matrix/client/unstable/room_keys/version/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn delete_backup_route( pub async fn delete_backup_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_backup::Request<'_>>, body: Ruma<delete_backup::Request<'_>>,
@ -123,6 +128,7 @@ pub async fn delete_backup_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/unstable/room_keys/keys", data = "<body>") put("/_matrix/client/unstable/room_keys/keys", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn add_backup_keys_route( pub async fn add_backup_keys_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<add_backup_keys::Request<'_>>, body: Ruma<add_backup_keys::Request<'_>>,
@ -156,6 +162,7 @@ pub async fn add_backup_keys_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/unstable/room_keys/keys/<_>", data = "<body>") put("/_matrix/client/unstable/room_keys/keys/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn add_backup_key_sessions_route( pub async fn add_backup_key_sessions_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<add_backup_key_sessions::Request<'_>>, body: Ruma<add_backup_key_sessions::Request<'_>>,
@ -187,6 +194,7 @@ pub async fn add_backup_key_sessions_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/unstable/room_keys/keys/<_>/<_>", data = "<body>") put("/_matrix/client/unstable/room_keys/keys/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn add_backup_key_session_route( pub async fn add_backup_key_session_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<add_backup_key_session::Request<'_>>, body: Ruma<add_backup_key_session::Request<'_>>,
@ -215,6 +223,7 @@ pub async fn add_backup_key_session_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/unstable/room_keys/keys", data = "<body>") get("/_matrix/client/unstable/room_keys/keys", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_backup_keys_route( pub async fn get_backup_keys_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_backup_keys::Request<'_>>, body: Ruma<get_backup_keys::Request<'_>>,
@ -230,6 +239,7 @@ pub async fn get_backup_keys_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/unstable/room_keys/keys/<_>", data = "<body>") get("/_matrix/client/unstable/room_keys/keys/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_backup_key_sessions_route( pub async fn get_backup_key_sessions_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_backup_key_sessions::Request<'_>>, body: Ruma<get_backup_key_sessions::Request<'_>>,
@ -247,6 +257,7 @@ pub async fn get_backup_key_sessions_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/unstable/room_keys/keys/<_>/<_>", data = "<body>") get("/_matrix/client/unstable/room_keys/keys/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_backup_key_session_route( pub async fn get_backup_key_session_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_backup_key_session::Request<'_>>, body: Ruma<get_backup_key_session::Request<'_>>,
@ -270,6 +281,7 @@ pub async fn get_backup_key_session_route(
feature = "conduit_bin", feature = "conduit_bin",
delete("/_matrix/client/unstable/room_keys/keys", data = "<body>") delete("/_matrix/client/unstable/room_keys/keys", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn delete_backup_keys_route( pub async fn delete_backup_keys_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_backup_keys::Request<'_>>, body: Ruma<delete_backup_keys::Request<'_>>,
@ -292,6 +304,7 @@ pub async fn delete_backup_keys_route(
feature = "conduit_bin", feature = "conduit_bin",
delete("/_matrix/client/unstable/room_keys/keys/<_>", data = "<body>") delete("/_matrix/client/unstable/room_keys/keys/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn delete_backup_key_sessions_route( pub async fn delete_backup_key_sessions_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_backup_key_sessions::Request<'_>>, body: Ruma<delete_backup_key_sessions::Request<'_>>,
@ -314,6 +327,7 @@ pub async fn delete_backup_key_sessions_route(
feature = "conduit_bin", feature = "conduit_bin",
delete("/_matrix/client/unstable/room_keys/keys/<_>/<_>", data = "<body>") delete("/_matrix/client/unstable/room_keys/keys/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn delete_backup_key_session_route( pub async fn delete_backup_key_session_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_backup_key_session::Request<'_>>, body: Ruma<delete_backup_key_session::Request<'_>>,

1
src/client_server/capabilities.rs

@ -9,6 +9,7 @@ use rocket::get;
/// ///
/// Get information on this server's supported feature set and other relevent capabilities. /// Get information on this server's supported feature set and other relevent capabilities.
#[cfg_attr(feature = "conduit_bin", get("/_matrix/client/r0/capabilities"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/client/r0/capabilities"))]
#[tracing::instrument]
pub async fn get_capabilities_route() -> ConduitResult<get_capabilities::Response> { pub async fn get_capabilities_route() -> ConduitResult<get_capabilities::Response> {
let mut available = BTreeMap::new(); let mut available = BTreeMap::new();
available.insert( available.insert(

2
src/client_server/config.rs

@ -16,6 +16,7 @@ use rocket::{get, put};
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/user/<_>/account_data/<_>", data = "<body>") put("/_matrix/client/r0/user/<_>/account_data/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn set_global_account_data_route( pub async fn set_global_account_data_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<set_global_account_data::Request<'_>>, body: Ruma<set_global_account_data::Request<'_>>,
@ -49,6 +50,7 @@ pub async fn set_global_account_data_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/user/<_>/account_data/<_>", data = "<body>") get("/_matrix/client/r0/user/<_>/account_data/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_global_account_data_route( pub async fn get_global_account_data_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_global_account_data::Request<'_>>, body: Ruma<get_global_account_data::Request<'_>>,

1
src/client_server/context.rs

@ -10,6 +10,7 @@ use rocket::get;
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/rooms/<_>/context/<_>", data = "<body>") get("/_matrix/client/r0/rooms/<_>/context/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_context_route( pub async fn get_context_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_context::Request<'_>>, body: Ruma<get_context::Request<'_>>,

5
src/client_server/device.rs

@ -16,6 +16,7 @@ use rocket::{delete, get, post, put};
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/devices", data = "<body>") get("/_matrix/client/r0/devices", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_devices_route( pub async fn get_devices_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_devices::Request>, body: Ruma<get_devices::Request>,
@ -35,6 +36,7 @@ pub async fn get_devices_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/devices/<_>", data = "<body>") get("/_matrix/client/r0/devices/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_device_route( pub async fn get_device_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_device::Request<'_>>, body: Ruma<get_device::Request<'_>>,
@ -53,6 +55,7 @@ pub async fn get_device_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/devices/<_>", data = "<body>") put("/_matrix/client/r0/devices/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn update_device_route( pub async fn update_device_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<update_device::Request<'_>>, body: Ruma<update_device::Request<'_>>,
@ -78,6 +81,7 @@ pub async fn update_device_route(
feature = "conduit_bin", feature = "conduit_bin",
delete("/_matrix/client/r0/devices/<_>", data = "<body>") delete("/_matrix/client/r0/devices/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn delete_device_route( pub async fn delete_device_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_device::Request<'_>>, body: Ruma<delete_device::Request<'_>>,
@ -126,6 +130,7 @@ pub async fn delete_device_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/delete_devices", data = "<body>") post("/_matrix/client/r0/delete_devices", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn delete_devices_route( pub async fn delete_devices_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_devices::Request<'_>>, body: Ruma<delete_devices::Request<'_>>,

4
src/client_server/directory.rs

@ -31,6 +31,7 @@ use rocket::{get, post, put};
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/publicRooms", data = "<body>") post("/_matrix/client/r0/publicRooms", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_public_rooms_filtered_route( pub async fn get_public_rooms_filtered_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_public_rooms_filtered::Request<'_>>, body: Ruma<get_public_rooms_filtered::Request<'_>>,
@ -50,6 +51,7 @@ pub async fn get_public_rooms_filtered_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/publicRooms", data = "<body>") get("/_matrix/client/r0/publicRooms", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_public_rooms_route( pub async fn get_public_rooms_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_public_rooms::Request<'_>>, body: Ruma<get_public_rooms::Request<'_>>,
@ -78,6 +80,7 @@ pub async fn get_public_rooms_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/directory/list/room/<_>", data = "<body>") put("/_matrix/client/r0/directory/list/room/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn set_room_visibility_route( pub async fn set_room_visibility_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<set_room_visibility::Request<'_>>, body: Ruma<set_room_visibility::Request<'_>>,
@ -107,6 +110,7 @@ pub async fn set_room_visibility_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/directory/list/room/<_>", data = "<body>") get("/_matrix/client/r0/directory/list/room/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_room_visibility_route( pub async fn get_room_visibility_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_room_visibility::Request<'_>>, body: Ruma<get_room_visibility::Request<'_>>,

2
src/client_server/filter.rs

@ -5,6 +5,7 @@ use ruma::api::client::r0::filter::{self, create_filter, get_filter};
use rocket::{get, post}; use rocket::{get, post};
#[cfg_attr(feature = "conduit_bin", get("/_matrix/client/r0/user/<_>/filter/<_>"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/client/r0/user/<_>/filter/<_>"))]
#[tracing::instrument]
pub async fn get_filter_route() -> ConduitResult<get_filter::Response> { pub async fn get_filter_route() -> ConduitResult<get_filter::Response> {
// TODO // TODO
Ok(get_filter::Response::new(filter::IncomingFilterDefinition { Ok(get_filter::Response::new(filter::IncomingFilterDefinition {
@ -18,6 +19,7 @@ pub async fn get_filter_route() -> ConduitResult<get_filter::Response> {
} }
#[cfg_attr(feature = "conduit_bin", post("/_matrix/client/r0/user/<_>/filter"))] #[cfg_attr(feature = "conduit_bin", post("/_matrix/client/r0/user/<_>/filter"))]
#[tracing::instrument]
pub async fn create_filter_route() -> ConduitResult<create_filter::Response> { pub async fn create_filter_route() -> ConduitResult<create_filter::Response> {
// TODO // TODO
Ok(create_filter::Response::new(utils::random_string(10)).into()) Ok(create_filter::Response::new(utils::random_string(10)).into())

6
src/client_server/keys.rs

@ -22,6 +22,7 @@ use rocket::{get, post};
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/keys/upload", data = "<body>") post("/_matrix/client/r0/keys/upload", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn upload_keys_route( pub async fn upload_keys_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<upload_keys::Request>, body: Ruma<upload_keys::Request>,
@ -70,6 +71,7 @@ pub async fn upload_keys_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/keys/query", data = "<body>") post("/_matrix/client/r0/keys/query", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_keys_route( pub async fn get_keys_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_keys::Request<'_>>, body: Ruma<get_keys::Request<'_>>,
@ -150,6 +152,7 @@ pub async fn get_keys_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/keys/claim", data = "<body>") post("/_matrix/client/r0/keys/claim", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn claim_keys_route( pub async fn claim_keys_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<claim_keys::Request>, body: Ruma<claim_keys::Request>,
@ -183,6 +186,7 @@ pub async fn claim_keys_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/unstable/keys/device_signing/upload", data = "<body>") post("/_matrix/client/unstable/keys/device_signing/upload", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn upload_signing_keys_route( pub async fn upload_signing_keys_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<upload_signing_keys::Request<'_>>, body: Ruma<upload_signing_keys::Request<'_>>,
@ -240,6 +244,7 @@ pub async fn upload_signing_keys_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/unstable/keys/signatures/upload", data = "<body>") post("/_matrix/client/unstable/keys/signatures/upload", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn upload_signatures_route( pub async fn upload_signatures_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<upload_signatures::Request>, body: Ruma<upload_signatures::Request>,
@ -300,6 +305,7 @@ pub async fn upload_signatures_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/keys/changes", data = "<body>") get("/_matrix/client/r0/keys/changes", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_key_changes_route( pub async fn get_key_changes_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_key_changes::Request<'_>>, body: Ruma<get_key_changes::Request<'_>>,

4
src/client_server/media.rs

@ -12,6 +12,7 @@ use std::convert::TryInto;
const MXC_LENGTH: usize = 32; const MXC_LENGTH: usize = 32;
#[cfg_attr(feature = "conduit_bin", get("/_matrix/media/r0/config"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/media/r0/config"))]
#[tracing::instrument(skip(db))]
pub async fn get_media_config_route( pub async fn get_media_config_route(
db: State<'_, Database>, db: State<'_, Database>,
) -> ConduitResult<get_media_config::Response> { ) -> ConduitResult<get_media_config::Response> {
@ -25,6 +26,7 @@ pub async fn get_media_config_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/media/r0/upload", data = "<body>") post("/_matrix/media/r0/upload", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn create_content_route( pub async fn create_content_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<create_content::Request<'_>>, body: Ruma<create_content::Request<'_>>,
@ -54,6 +56,7 @@ pub async fn create_content_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/media/r0/download/<_>/<_>", data = "<body>") get("/_matrix/media/r0/download/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_content_route( pub async fn get_content_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_content::Request<'_>>, body: Ruma<get_content::Request<'_>>,
@ -103,6 +106,7 @@ pub async fn get_content_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/media/r0/thumbnail/<_>/<_>", data = "<body>") get("/_matrix/media/r0/thumbnail/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_content_thumbnail_route( pub async fn get_content_thumbnail_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_content_thumbnail::Request<'_>>, body: Ruma<get_content_thumbnail::Request<'_>>,

11
src/client_server/membership.rs

@ -36,6 +36,7 @@ use rocket::{get, post};
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/rooms/<_>/join", data = "<body>") post("/_matrix/client/r0/rooms/<_>/join", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn join_room_by_id_route( pub async fn join_room_by_id_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<join_room_by_id::Request<'_>>, body: Ruma<join_room_by_id::Request<'_>>,
@ -54,6 +55,7 @@ pub async fn join_room_by_id_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/join/<_>", data = "<body>") post("/_matrix/client/r0/join/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn join_room_by_id_or_alias_route( pub async fn join_room_by_id_or_alias_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<join_room_by_id_or_alias::Request<'_>>, body: Ruma<join_room_by_id_or_alias::Request<'_>>,
@ -88,6 +90,7 @@ pub async fn join_room_by_id_or_alias_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/rooms/<_>/leave", data = "<body>") post("/_matrix/client/r0/rooms/<_>/leave", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn leave_room_route( pub async fn leave_room_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<leave_room::Request<'_>>, body: Ruma<leave_room::Request<'_>>,
@ -136,6 +139,7 @@ pub async fn leave_room_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/rooms/<_>/invite", data = "<body>") post("/_matrix/client/r0/rooms/<_>/invite", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn invite_user_route( pub async fn invite_user_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<invite_user::Request<'_>>, body: Ruma<invite_user::Request<'_>>,
@ -175,6 +179,7 @@ pub async fn invite_user_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/rooms/<_>/kick", data = "<body>") post("/_matrix/client/r0/rooms/<_>/kick", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn kick_user_route( pub async fn kick_user_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<kick_user::Request<'_>>, body: Ruma<kick_user::Request<'_>>,
@ -224,6 +229,7 @@ pub async fn kick_user_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/rooms/<_>/ban", data = "<body>") post("/_matrix/client/r0/rooms/<_>/ban", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn ban_user_route( pub async fn ban_user_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<ban_user::Request<'_>>, body: Ruma<ban_user::Request<'_>>,
@ -280,6 +286,7 @@ pub async fn ban_user_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/rooms/<_>/unban", data = "<body>") post("/_matrix/client/r0/rooms/<_>/unban", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn unban_user_route( pub async fn unban_user_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<unban_user::Request<'_>>, body: Ruma<unban_user::Request<'_>>,
@ -328,6 +335,7 @@ pub async fn unban_user_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/rooms/<_>/forget", data = "<body>") post("/_matrix/client/r0/rooms/<_>/forget", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn forget_room_route( pub async fn forget_room_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<forget_room::Request<'_>>, body: Ruma<forget_room::Request<'_>>,
@ -345,6 +353,7 @@ pub async fn forget_room_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/joined_rooms", data = "<body>") get("/_matrix/client/r0/joined_rooms", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn joined_rooms_route( pub async fn joined_rooms_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<joined_rooms::Request>, body: Ruma<joined_rooms::Request>,
@ -365,6 +374,7 @@ pub async fn joined_rooms_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/rooms/<_>/members", data = "<body>") get("/_matrix/client/r0/rooms/<_>/members", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_member_events_route( pub async fn get_member_events_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_member_events::Request<'_>>, body: Ruma<get_member_events::Request<'_>>,
@ -394,6 +404,7 @@ pub async fn get_member_events_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/rooms/<_>/joined_members", data = "<body>") get("/_matrix/client/r0/rooms/<_>/joined_members", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn joined_members_route( pub async fn joined_members_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<joined_members::Request<'_>>, body: Ruma<joined_members::Request<'_>>,

2
src/client_server/message.rs

@ -20,6 +20,7 @@ use rocket::{get, put};
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/rooms/<_>/send/<_>/<_>", data = "<body>") put("/_matrix/client/r0/rooms/<_>/send/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn send_message_event_route( pub async fn send_message_event_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<send_message_event::Request<'_>>, body: Ruma<send_message_event::Request<'_>>,
@ -87,6 +88,7 @@ pub async fn send_message_event_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/rooms/<_>/messages", data = "<body>") get("/_matrix/client/r0/rooms/<_>/messages", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_message_events_route( pub async fn get_message_events_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_message_events::Request<'_>>, body: Ruma<get_message_events::Request<'_>>,

1
src/client_server/mod.rs

@ -75,6 +75,7 @@ const SESSION_ID_LENGTH: usize = 256;
#[cfg(feature = "conduit_bin")] #[cfg(feature = "conduit_bin")]
#[options("/<_..>")] #[options("/<_..>")]
#[tracing::instrument]
pub async fn options_route() -> ConduitResult<send_event_to_device::Response> { pub async fn options_route() -> ConduitResult<send_event_to_device::Response> {
Ok(send_event_to_device::Response.into()) Ok(send_event_to_device::Response.into())
} }

1
src/client_server/presence.rs

@ -10,6 +10,7 @@ use rocket::put;
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/presence/<_>/status", data = "<body>") put("/_matrix/client/r0/presence/<_>/status", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn set_presence_route( pub async fn set_presence_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<set_presence::Request<'_>>, body: Ruma<set_presence::Request<'_>>,

5
src/client_server/profile.rs

@ -19,6 +19,7 @@ use std::convert::TryInto;
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/profile/<_>/displayname", data = "<body>") put("/_matrix/client/r0/profile/<_>/displayname", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn set_displayname_route( pub async fn set_displayname_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<set_display_name::Request<'_>>, body: Ruma<set_display_name::Request<'_>>,
@ -98,6 +99,7 @@ pub async fn set_displayname_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/profile/<_>/displayname", data = "<body>") get("/_matrix/client/r0/profile/<_>/displayname", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_displayname_route( pub async fn get_displayname_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_display_name::Request<'_>>, body: Ruma<get_display_name::Request<'_>>,
@ -112,6 +114,7 @@ pub async fn get_displayname_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/profile/<_>/avatar_url", data = "<body>") put("/_matrix/client/r0/profile/<_>/avatar_url", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn set_avatar_url_route( pub async fn set_avatar_url_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<set_avatar_url::Request<'_>>, body: Ruma<set_avatar_url::Request<'_>>,
@ -191,6 +194,7 @@ pub async fn set_avatar_url_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/profile/<_>/avatar_url", data = "<body>") get("/_matrix/client/r0/profile/<_>/avatar_url", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_avatar_url_route( pub async fn get_avatar_url_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_avatar_url::Request<'_>>, body: Ruma<get_avatar_url::Request<'_>>,
@ -205,6 +209,7 @@ pub async fn get_avatar_url_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/profile/<_>", data = "<body>") get("/_matrix/client/r0/profile/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_profile_route( pub async fn get_profile_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_profile::Request<'_>>, body: Ruma<get_profile::Request<'_>>,

10
src/client_server/push.rs

@ -23,6 +23,7 @@ use rocket::{delete, get, post, put};
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/pushrules", data = "<body>") get("/_matrix/client/r0/pushrules", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_pushrules_all_route( pub async fn get_pushrules_all_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_pushrules_all::Request>, body: Ruma<get_pushrules_all::Request>,
@ -47,6 +48,7 @@ pub async fn get_pushrules_all_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/pushrules/<_>/<_>/<_>", data = "<body>") get("/_matrix/client/r0/pushrules/<_>/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_pushrule_route( pub async fn get_pushrule_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_pushrule::Request<'_>>, body: Ruma<get_pushrule::Request<'_>>,
@ -105,6 +107,7 @@ pub async fn get_pushrule_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/pushrules/<_>/<_>/<_>", data = "<body>") put("/_matrix/client/r0/pushrules/<_>/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn set_pushrule_route( pub async fn set_pushrule_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<set_pushrule::Request<'_>>, body: Ruma<set_pushrule::Request<'_>>,
@ -251,6 +254,7 @@ pub async fn set_pushrule_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/pushrules/<_>/<_>/<_>/actions", data = "<body>") get("/_matrix/client/r0/pushrules/<_>/<_>/<_>/actions", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_pushrule_actions_route( pub async fn get_pushrule_actions_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_pushrule_actions::Request<'_>>, body: Ruma<get_pushrule_actions::Request<'_>>,
@ -314,6 +318,7 @@ pub async fn get_pushrule_actions_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/pushrules/<_>/<_>/<_>/actions", data = "<body>") put("/_matrix/client/r0/pushrules/<_>/<_>/<_>/actions", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn set_pushrule_actions_route( pub async fn set_pushrule_actions_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<set_pushrule_actions::Request<'_>>, body: Ruma<set_pushrule_actions::Request<'_>>,
@ -417,6 +422,7 @@ pub async fn set_pushrule_actions_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/pushrules/<_>/<_>/<_>/enabled", data = "<body>") get("/_matrix/client/r0/pushrules/<_>/<_>/<_>/enabled", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_pushrule_enabled_route( pub async fn get_pushrule_enabled_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_pushrule_enabled::Request<'_>>, body: Ruma<get_pushrule_enabled::Request<'_>>,
@ -477,6 +483,7 @@ pub async fn get_pushrule_enabled_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/pushrules/<_>/<_>/<_>/enabled", data = "<body>") put("/_matrix/client/r0/pushrules/<_>/<_>/<_>/enabled", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn set_pushrule_enabled_route( pub async fn set_pushrule_enabled_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<set_pushrule_enabled::Request<'_>>, body: Ruma<set_pushrule_enabled::Request<'_>>,
@ -580,6 +587,7 @@ pub async fn set_pushrule_enabled_route(
feature = "conduit_bin", feature = "conduit_bin",
delete("/_matrix/client/r0/pushrules/<_>/<_>/<_>", data = "<body>") delete("/_matrix/client/r0/pushrules/<_>/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn delete_pushrule_route( pub async fn delete_pushrule_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_pushrule::Request<'_>>, body: Ruma<delete_pushrule::Request<'_>>,
@ -673,6 +681,7 @@ pub async fn delete_pushrule_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/pushers", data = "<body>") get("/_matrix/client/r0/pushers", data = "<body>")
)] )]
#[tracing::instrument(skip(db))]
pub async fn get_pushers_route( pub async fn get_pushers_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_pushers::Request>, body: Ruma<get_pushers::Request>,
@ -689,6 +698,7 @@ pub async fn get_pushers_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/pushers/set", data = "<body>") post("/_matrix/client/r0/pushers/set", data = "<body>")
)] )]
#[tracing::instrument(skip(db))]
pub async fn set_pushers_route( pub async fn set_pushers_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<set_pusher::Request>, body: Ruma<set_pusher::Request>,

53
src/client_server/read_marker.rs

@ -3,7 +3,7 @@ use crate::{ConduitResult, Database, Error, Ruma};
use ruma::{ use ruma::{
api::client::{ api::client::{
error::ErrorKind, error::ErrorKind,
r0::{capabilities::get_capabilities, read_marker::set_read_marker}, r0::{read_marker::set_read_marker, receipt::create_receipt},
}, },
events::{AnyEphemeralRoomEvent, AnyEvent, EventType}, events::{AnyEphemeralRoomEvent, AnyEvent, EventType},
}; };
@ -16,6 +16,7 @@ use std::{collections::BTreeMap, time::SystemTime};
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/rooms/<_>/read_markers", data = "<body>") post("/_matrix/client/r0/rooms/<_>/read_markers", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn set_read_marker_route( pub async fn set_read_marker_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<set_read_marker::Request<'_>>, body: Ruma<set_read_marker::Request<'_>>,
@ -84,13 +85,53 @@ pub async fn set_read_marker_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/rooms/<_>/receipt/<_>/<_>", data = "<body>") post("/_matrix/client/r0/rooms/<_>/receipt/<_>/<_>", data = "<body>")
)] )]
pub async fn set_receipt_route( #[tracing::instrument(skip(db, body))]
pub async fn create_receipt_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_capabilities::Request>, body: Ruma<create_receipt::Request<'_>>,
) -> ConduitResult<set_read_marker::Response> { ) -> ConduitResult<create_receipt::Response> {
let _sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
db.rooms.edus.private_read_set(
&body.room_id,
&sender_user,
db.rooms
.get_pdu_count(&body.event_id)?
.ok_or(Error::BadRequest(
ErrorKind::InvalidParam,
"Event does not exist.",
))?,
&db.globals,
)?;
let mut user_receipts = BTreeMap::new();
user_receipts.insert(
sender_user.clone(),
ruma::events::receipt::Receipt {
ts: Some(SystemTime::now()),
},
);
let mut receipt_content = BTreeMap::new();
receipt_content.insert(
body.event_id.to_owned(),
ruma::events::receipt::Receipts {
read: Some(user_receipts),
},
);
db.rooms.edus.readreceipt_update(
&sender_user,
&body.room_id,
AnyEvent::Ephemeral(AnyEphemeralRoomEvent::Receipt(
ruma::events::receipt::ReceiptEvent {
content: ruma::events::receipt::ReceiptEventContent(receipt_content),
room_id: body.room_id.clone(),
},
)),
&db.globals,
)?;
db.flush().await?; db.flush().await?;
Ok(set_read_marker::Response.into()) Ok(create_receipt::Response.into())
} }

1
src/client_server/redact.rs

@ -12,6 +12,7 @@ use rocket::put;
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/rooms/<_>/redact/<_>/<_>", data = "<body>") put("/_matrix/client/r0/rooms/<_>/redact/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn redact_event_route( pub async fn redact_event_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<redact_event::Request<'_>>, body: Ruma<redact_event::Request<'_>>,

3
src/client_server/room.rs

@ -22,6 +22,7 @@ use rocket::{get, post};
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/createRoom", data = "<body>") post("/_matrix/client/r0/createRoom", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn create_room_route( pub async fn create_room_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<create_room::Request<'_>>, body: Ruma<create_room::Request<'_>>,
@ -306,6 +307,7 @@ pub async fn create_room_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/rooms/<_>/event/<_>", data = "<body>") get("/_matrix/client/r0/rooms/<_>/event/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_room_event_route( pub async fn get_room_event_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_room_event::Request<'_>>, body: Ruma<get_room_event::Request<'_>>,
@ -333,6 +335,7 @@ pub async fn get_room_event_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/rooms/<_room_id>/upgrade", data = "<body>") post("/_matrix/client/r0/rooms/<_room_id>/upgrade", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn upgrade_room_route( pub async fn upgrade_room_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<upgrade_room::Request<'_>>, body: Ruma<upgrade_room::Request<'_>>,

1
src/client_server/search.rs

@ -11,6 +11,7 @@ use std::collections::BTreeMap;
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/search", data = "<body>") post("/_matrix/client/r0/search", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn search_events_route( pub async fn search_events_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<search_events::Request<'_>>, body: Ruma<search_events::Request<'_>>,

7
src/client_server/session.rs

@ -24,6 +24,7 @@ use rocket::{get, post};
/// Get the homeserver's supported login types. One of these should be used as the `type` field /// Get the homeserver's supported login types. One of these should be used as the `type` field
/// when logging in. /// when logging in.
#[cfg_attr(feature = "conduit_bin", get("/_matrix/client/r0/login"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/client/r0/login"))]
#[tracing::instrument]
pub async fn get_login_types_route() -> ConduitResult<get_login_types::Response> { pub async fn get_login_types_route() -> ConduitResult<get_login_types::Response> {
Ok(get_login_types::Response::new(vec![get_login_types::LoginType::Password]).into()) Ok(get_login_types::Response::new(vec![get_login_types::LoginType::Password]).into())
} }
@ -42,6 +43,7 @@ pub async fn get_login_types_route() -> ConduitResult<get_login_types::Response>
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/login", data = "<body>") post("/_matrix/client/r0/login", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn login_route( pub async fn login_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<login::Request<'_>>, body: Ruma<login::Request<'_>>,
@ -117,8 +119,7 @@ pub async fn login_route(
let device_exists = body.device_id.as_ref().map_or(false, |device_id| { let device_exists = body.device_id.as_ref().map_or(false, |device_id| {
db.users db.users
.all_device_ids(&user_id) .all_device_ids(&user_id)
.find(|x| x.as_ref().map_or(false, |v| v == device_id)) .any(|x| x.as_ref().map_or(false, |v| v == device_id))
.is_some()
}); });
if device_exists { if device_exists {
@ -156,6 +157,7 @@ pub async fn login_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/logout", data = "<body>") post("/_matrix/client/r0/logout", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn logout_route( pub async fn logout_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<logout::Request>, body: Ruma<logout::Request>,
@ -183,6 +185,7 @@ pub async fn logout_route(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/logout/all", data = "<body>") post("/_matrix/client/r0/logout/all", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn logout_all_route( pub async fn logout_all_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<logout_all::Request>, body: Ruma<logout_all::Request>,

5
src/client_server/state.rs

@ -22,6 +22,7 @@ use rocket::{get, put};
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/rooms/<_>/state/<_>/<_>", data = "<body>") put("/_matrix/client/r0/rooms/<_>/state/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn send_state_event_for_key_route( pub async fn send_state_event_for_key_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<send_state_event_for_key::Request<'_>>, body: Ruma<send_state_event_for_key::Request<'_>>,
@ -55,6 +56,7 @@ pub async fn send_state_event_for_key_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/rooms/<_>/state/<_>", data = "<body>") put("/_matrix/client/r0/rooms/<_>/state/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn send_state_event_for_empty_key_route( pub async fn send_state_event_for_empty_key_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<send_state_event_for_empty_key::Request<'_>>, body: Ruma<send_state_event_for_empty_key::Request<'_>>,
@ -96,6 +98,7 @@ pub async fn send_state_event_for_empty_key_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/rooms/<_>/state", data = "<body>") get("/_matrix/client/r0/rooms/<_>/state", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_state_events_route( pub async fn get_state_events_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_state_events::Request<'_>>, body: Ruma<get_state_events::Request<'_>>,
@ -142,6 +145,7 @@ pub async fn get_state_events_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/rooms/<_>/state/<_>/<_>", data = "<body>") get("/_matrix/client/r0/rooms/<_>/state/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_state_events_for_key_route( pub async fn get_state_events_for_key_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_state_events_for_key::Request<'_>>, body: Ruma<get_state_events_for_key::Request<'_>>,
@ -193,6 +197,7 @@ pub async fn get_state_events_for_key_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/rooms/<_>/state/<_>", data = "<body>") get("/_matrix/client/r0/rooms/<_>/state/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_state_events_for_empty_key_route( pub async fn get_state_events_for_empty_key_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_state_events_for_empty_key::Request<'_>>, body: Ruma<get_state_events_for_empty_key::Request<'_>>,

5
src/client_server/sync.rs

@ -30,6 +30,7 @@ use std::{
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/sync", data = "<body>") get("/_matrix/client/r0/sync", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn sync_events_route( pub async fn sync_events_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<sync_events::Request<'_>>, body: Ruma<sync_events::Request<'_>>,
@ -310,8 +311,7 @@ pub async fn sync_events_route(
}; };
let state_events = if joined_since_last_sync { let state_events = if joined_since_last_sync {
db.rooms current_state
.room_state_full(&room_id)?
.into_iter() .into_iter()
.map(|(_, pdu)| pdu.to_sync_state_event()) .map(|(_, pdu)| pdu.to_sync_state_event())
.collect() .collect()
@ -709,6 +709,7 @@ pub async fn sync_events_route(
Ok(response.into()) Ok(response.into())
} }
#[tracing::instrument(skip(db))]
fn share_encrypted_room( fn share_encrypted_room(
db: &Database, db: &Database,
sender_user: &UserId, sender_user: &UserId,

3
src/client_server/tag.rs

@ -13,6 +13,7 @@ use rocket::{delete, get, put};
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/user/<_>/rooms/<_>/tags/<_>", data = "<body>") put("/_matrix/client/r0/user/<_>/rooms/<_>/tags/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn update_tag_route( pub async fn update_tag_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<create_tag::Request<'_>>, body: Ruma<create_tag::Request<'_>>,
@ -49,6 +50,7 @@ pub async fn update_tag_route(
feature = "conduit_bin", feature = "conduit_bin",
delete("/_matrix/client/r0/user/<_>/rooms/<_>/tags/<_>", data = "<body>") delete("/_matrix/client/r0/user/<_>/rooms/<_>/tags/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn delete_tag_route( pub async fn delete_tag_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_tag::Request<'_>>, body: Ruma<delete_tag::Request<'_>>,
@ -82,6 +84,7 @@ pub async fn delete_tag_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/user/<_>/rooms/<_>/tags", data = "<body>") get("/_matrix/client/r0/user/<_>/rooms/<_>/tags", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_tags_route( pub async fn get_tags_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_tags::Request<'_>>, body: Ruma<get_tags::Request<'_>>,

1
src/client_server/thirdparty.rs

@ -10,6 +10,7 @@ use std::collections::BTreeMap;
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/client/r0/thirdparty/protocols") get("/_matrix/client/r0/thirdparty/protocols")
)] )]
#[tracing::instrument]
pub async fn get_protocols_route() -> ConduitResult<get_protocols::Response> { pub async fn get_protocols_route() -> ConduitResult<get_protocols::Response> {
warn!("TODO: get_protocols_route"); warn!("TODO: get_protocols_route");
Ok(get_protocols::Response { Ok(get_protocols::Response {

1
src/client_server/to_device.rs

@ -12,6 +12,7 @@ use rocket::put;
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/sendToDevice/<_>/<_>", data = "<body>") put("/_matrix/client/r0/sendToDevice/<_>/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn send_event_to_device_route( pub async fn send_event_to_device_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<send_event_to_device::Request<'_>>, body: Ruma<send_event_to_device::Request<'_>>,

1
src/client_server/typing.rs

@ -10,6 +10,7 @@ use rocket::put;
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/client/r0/rooms/<_>/typing/<_>", data = "<body>") put("/_matrix/client/r0/rooms/<_>/typing/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub fn create_typing_event_route( pub fn create_typing_event_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<create_typing_event::Request<'_>>, body: Ruma<create_typing_event::Request<'_>>,

1
src/client_server/unversioned.rs

@ -15,6 +15,7 @@ use rocket::get;
/// Note: Unstable features are used while developing new features. Clients should avoid using /// Note: Unstable features are used while developing new features. Clients should avoid using
/// unstable features in their stable releases /// unstable features in their stable releases
#[cfg_attr(feature = "conduit_bin", get("/_matrix/client/versions"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/client/versions"))]
#[tracing::instrument]
pub async fn get_supported_versions_route() -> ConduitResult<get_supported_versions::Response> { pub async fn get_supported_versions_route() -> ConduitResult<get_supported_versions::Response> {
let mut resp = let mut resp =
get_supported_versions::Response::new(vec!["r0.5.0".to_owned(), "r0.6.0".to_owned()]); get_supported_versions::Response::new(vec!["r0.5.0".to_owned(), "r0.6.0".to_owned()]);

1
src/client_server/user_directory.rs

@ -9,6 +9,7 @@ use rocket::post;
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/client/r0/user_directory/search", data = "<body>") post("/_matrix/client/r0/user_directory/search", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn search_users_route( pub async fn search_users_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<search_users::Request<'_>>, body: Ruma<search_users::Request<'_>>,

1
src/client_server/voip.rs

@ -6,6 +6,7 @@ use std::time::Duration;
use rocket::get; use rocket::get;
#[cfg_attr(feature = "conduit_bin", get("/_matrix/client/r0/voip/turnServer"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/client/r0/voip/turnServer"))]
#[tracing::instrument]
pub async fn turn_server_route() -> ConduitResult<get_turn_server_info::Response> { pub async fn turn_server_route() -> ConduitResult<get_turn_server_info::Response> {
Ok(get_turn_server_info::Response { Ok(get_turn_server_info::Response {
username: "".to_owned(), username: "".to_owned(),

2
src/database.rs

@ -41,6 +41,8 @@ pub struct Config {
allow_encryption: bool, allow_encryption: bool,
#[serde(default = "false_fn")] #[serde(default = "false_fn")]
allow_federation: bool, allow_federation: bool,
#[serde(default = "false_fn")]
pub allow_jaeger: bool,
jwt_secret: Option<String>, jwt_secret: Option<String>,
} }

1
src/database/account_data.rs

@ -74,6 +74,7 @@ impl AccountData {
} }
/// Returns all changes to the account data that happened after `since`. /// Returns all changes to the account data that happened after `since`.
#[tracing::instrument(skip(self))]
pub fn changes_since( pub fn changes_since(
&self, &self,
room_id: Option<&RoomId>, room_id: Option<&RoomId>,

3
src/database/admin.rs

@ -7,7 +7,6 @@ use ruma::{
events::{room::message, EventType}, events::{room::message, EventType},
UserId, UserId,
}; };
use tokio::select;
pub enum AdminCommand { pub enum AdminCommand {
RegisterAppservice(serde_yaml::Value), RegisterAppservice(serde_yaml::Value),
@ -67,7 +66,7 @@ impl Admin {
}; };
loop { loop {
select! { tokio::select! {
Some(event) = receiver.next() => { Some(event) = receiver.next() => {
match event { match event {
AdminCommand::RegisterAppservice(yaml) => { AdminCommand::RegisterAppservice(yaml) => {

3
src/database/globals.rs

@ -9,9 +9,10 @@ use trust_dns_resolver::TokioAsyncResolver;
pub const COUNTER: &str = "c"; pub const COUNTER: &str = "c";
type WellKnownMap = HashMap<Box<ServerName>, (String, Option<String>)>;
#[derive(Clone)] #[derive(Clone)]
pub struct Globals { pub struct Globals {
pub actual_destination_cache: Arc<RwLock<HashMap<Box<ServerName>, (String, Option<String>)>>>, // actual_destination, host pub actual_destination_cache: Arc<RwLock<WellKnownMap>>, // actual_destination, host
pub(super) globals: sled::Tree, pub(super) globals: sled::Tree,
config: Config, config: Config,
keypair: Arc<ruma::signatures::Ed25519KeyPair>, keypair: Arc<ruma::signatures::Ed25519KeyPair>,

26
src/database/rooms.rs

@ -70,6 +70,7 @@ pub struct Rooms {
impl Rooms { impl Rooms {
/// Builds a StateMap by iterating over all keys that start /// Builds a StateMap by iterating over all keys that start
/// with state_hash, this gives the full state for the given state_hash. /// with state_hash, this gives the full state for the given state_hash.
#[tracing::instrument(skip(self))]
pub fn state_full( pub fn state_full(
&self, &self,
room_id: &RoomId, room_id: &RoomId,
@ -107,6 +108,7 @@ impl Rooms {
} }
/// Returns a single PDU from `room_id` with key (`event_type`, `state_key`). /// Returns a single PDU from `room_id` with key (`event_type`, `state_key`).
#[tracing::instrument(skip(self))]
pub fn state_get( pub fn state_get(
&self, &self,
room_id: &RoomId, room_id: &RoomId,
@ -148,11 +150,13 @@ impl Rooms {
} }
/// Returns the last state hash key added to the db. /// Returns the last state hash key added to the db.
#[tracing::instrument(skip(self))]
pub fn pdu_state_hash(&self, pdu_id: &[u8]) -> Result<Option<StateHashId>> { pub fn pdu_state_hash(&self, pdu_id: &[u8]) -> Result<Option<StateHashId>> {
Ok(self.pduid_statehash.get(pdu_id)?) Ok(self.pduid_statehash.get(pdu_id)?)
} }
/// Returns the last state hash key added to the db for the given room. /// Returns the last state hash key added to the db for the given room.
#[tracing::instrument(skip(self))]
pub fn current_state_hash(&self, room_id: &RoomId) -> Result<Option<StateHashId>> { pub fn current_state_hash(&self, room_id: &RoomId) -> Result<Option<StateHashId>> {
Ok(self.roomid_statehash.get(room_id.as_bytes())?) Ok(self.roomid_statehash.get(room_id.as_bytes())?)
} }
@ -258,6 +262,7 @@ impl Rooms {
} }
/// Returns the full room state. /// Returns the full room state.
#[tracing::instrument(skip(self))]
pub fn room_state_full( pub fn room_state_full(
&self, &self,
room_id: &RoomId, room_id: &RoomId,
@ -270,6 +275,7 @@ impl Rooms {
} }
/// Returns a single PDU from `room_id` with key (`event_type`, `state_key`). /// Returns a single PDU from `room_id` with key (`event_type`, `state_key`).
#[tracing::instrument(skip(self))]
pub fn room_state_get( pub fn room_state_get(
&self, &self,
room_id: &RoomId, room_id: &RoomId,
@ -284,6 +290,7 @@ impl Rooms {
} }
/// Returns the `count` of this pdu's id. /// Returns the `count` of this pdu's id.
#[tracing::instrument(skip(self))]
pub fn pdu_count(&self, pdu_id: &[u8]) -> Result<u64> { pub fn pdu_count(&self, pdu_id: &[u8]) -> Result<u64> {
Ok( Ok(
utils::u64_from_bytes(&pdu_id[pdu_id.len() - mem::size_of::<u64>()..pdu_id.len()]) utils::u64_from_bytes(&pdu_id[pdu_id.len() - mem::size_of::<u64>()..pdu_id.len()])
@ -413,6 +420,7 @@ impl Rooms {
/// ///
/// By this point the incoming event should be fully authenticated, no auth happens /// By this point the incoming event should be fully authenticated, no auth happens
/// in `append_pdu`. /// in `append_pdu`.
#[allow(clippy::too_many_arguments)]
pub fn append_pdu( pub fn append_pdu(
&self, &self,
pdu: &PduEvent, pdu: &PduEvent,
@ -917,9 +925,7 @@ impl Rooms {
let users = namespaces let users = namespaces
.get("users") .get("users")
.and_then(|users| users.as_sequence()) .and_then(|users| users.as_sequence())
.map_or_else( .map_or_else(Vec::new, |users| {
|| Vec::new(),
|users| {
users users
.iter() .iter()
.map(|users| { .map(|users| {
@ -930,8 +936,7 @@ impl Rooms {
}) })
.filter_map(|o| o) .filter_map(|o| o)
.collect::<Vec<_>>() .collect::<Vec<_>>()
}, });
);
let aliases = namespaces let aliases = namespaces
.get("aliases") .get("aliases")
.and_then(|users| users.get("regex")) .and_then(|users| users.get("regex"))
@ -950,7 +955,7 @@ impl Rooms {
.and_then(|string| { .and_then(|string| {
UserId::parse_with_server_name(string, db.globals.server_name()).ok() UserId::parse_with_server_name(string, db.globals.server_name()).ok()
}); });
#[allow(clippy::blocks_in_if_conditions)]
if bridge_user_id.map_or(false, |bridge_user_id| { if bridge_user_id.map_or(false, |bridge_user_id| {
self.is_joined(&bridge_user_id, room_id).unwrap_or(false) self.is_joined(&bridge_user_id, room_id).unwrap_or(false)
}) || users.iter().any(|users| { }) || users.iter().any(|users| {
@ -979,6 +984,7 @@ impl Rooms {
} }
/// Returns an iterator over all PDUs in a room. /// Returns an iterator over all PDUs in a room.
#[tracing::instrument(skip(self))]
pub fn all_pdus( pub fn all_pdus(
&self, &self,
user_id: &UserId, user_id: &UserId,
@ -989,6 +995,7 @@ impl Rooms {
/// Returns a double-ended iterator over all events in a room that happened after the event with id `since` /// Returns a double-ended iterator over all events in a room that happened after the event with id `since`
/// in chronological order. /// in chronological order.
#[tracing::instrument(skip(self))]
pub fn pdus_since( pub fn pdus_since(
&self, &self,
user_id: &UserId, user_id: &UserId,
@ -1055,6 +1062,7 @@ impl Rooms {
/// Returns an iterator over all events and their token in a room that happened after the event /// Returns an iterator over all events and their token in a room that happened after the event
/// with id `from` in chronological order. /// with id `from` in chronological order.
#[tracing::instrument(skip(self))]
pub fn pdus_after( pub fn pdus_after(
&self, &self,
user_id: &UserId, user_id: &UserId,
@ -1404,6 +1412,7 @@ impl Rooms {
)) ))
} }
#[tracing::instrument(skip(self))]
pub fn get_shared_rooms<'a>( pub fn get_shared_rooms<'a>(
&'a self, &'a self,
users: Vec<UserId>, users: Vec<UserId>,
@ -1465,6 +1474,7 @@ impl Rooms {
} }
/// Returns an iterator over all joined members of a room. /// Returns an iterator over all joined members of a room.
#[tracing::instrument(skip(self))]
pub fn room_members(&self, room_id: &RoomId) -> impl Iterator<Item = Result<UserId>> { pub fn room_members(&self, room_id: &RoomId) -> impl Iterator<Item = Result<UserId>> {
let mut prefix = room_id.as_bytes().to_vec(); let mut prefix = room_id.as_bytes().to_vec();
prefix.push(0xff); prefix.push(0xff);
@ -1513,6 +1523,7 @@ impl Rooms {
} }
/// Returns an iterator over all invited members of a room. /// Returns an iterator over all invited members of a room.
#[tracing::instrument(skip(self))]
pub fn room_members_invited(&self, room_id: &RoomId) -> impl Iterator<Item = Result<UserId>> { pub fn room_members_invited(&self, room_id: &RoomId) -> impl Iterator<Item = Result<UserId>> {
let mut prefix = room_id.as_bytes().to_vec(); let mut prefix = room_id.as_bytes().to_vec();
prefix.push(0xff); prefix.push(0xff);
@ -1537,6 +1548,7 @@ impl Rooms {
} }
/// Returns an iterator over all rooms this user joined. /// Returns an iterator over all rooms this user joined.
#[tracing::instrument(skip(self))]
pub fn rooms_joined(&self, user_id: &UserId) -> impl Iterator<Item = Result<RoomId>> { pub fn rooms_joined(&self, user_id: &UserId) -> impl Iterator<Item = Result<RoomId>> {
self.userroomid_joined self.userroomid_joined
.scan_prefix(user_id.as_bytes()) .scan_prefix(user_id.as_bytes())
@ -1558,6 +1570,7 @@ impl Rooms {
} }
/// Returns an iterator over all rooms a user was invited to. /// Returns an iterator over all rooms a user was invited to.
#[tracing::instrument(skip(self))]
pub fn rooms_invited(&self, user_id: &UserId) -> impl Iterator<Item = Result<RoomId>> { pub fn rooms_invited(&self, user_id: &UserId) -> impl Iterator<Item = Result<RoomId>> {
let mut prefix = user_id.as_bytes().to_vec(); let mut prefix = user_id.as_bytes().to_vec();
prefix.push(0xff); prefix.push(0xff);
@ -1582,6 +1595,7 @@ impl Rooms {
} }
/// Returns an iterator over all rooms a user left. /// Returns an iterator over all rooms a user left.
#[tracing::instrument(skip(self))]
pub fn rooms_left(&self, user_id: &UserId) -> impl Iterator<Item = Result<RoomId>> { pub fn rooms_left(&self, user_id: &UserId) -> impl Iterator<Item = Result<RoomId>> {
let mut prefix = user_id.as_bytes().to_vec(); let mut prefix = user_id.as_bytes().to_vec();
prefix.push(0xff); prefix.push(0xff);

5
src/database/rooms/edus.rs

@ -70,6 +70,7 @@ impl RoomEdus {
} }
/// Returns an iterator over the most recent read_receipts in a room that happened after the event with id `since`. /// Returns an iterator over the most recent read_receipts in a room that happened after the event with id `since`.
#[tracing::instrument(skip(self))]
pub fn readreceipts_since( pub fn readreceipts_since(
&self, &self,
room_id: &RoomId, room_id: &RoomId,
@ -115,6 +116,7 @@ impl RoomEdus {
} }
/// Returns the private read marker. /// Returns the private read marker.
#[tracing::instrument(skip(self))]
pub fn private_read_get(&self, room_id: &RoomId, user_id: &UserId) -> Result<Option<u64>> { pub fn private_read_get(&self, room_id: &RoomId, user_id: &UserId) -> Result<Option<u64>> {
let mut key = room_id.to_string().as_bytes().to_vec(); let mut key = room_id.to_string().as_bytes().to_vec();
key.push(0xff); key.push(0xff);
@ -256,6 +258,7 @@ impl RoomEdus {
} }
/// Returns the count of the last typing update in this room. /// Returns the count of the last typing update in this room.
#[tracing::instrument(skip(self, globals))]
pub fn last_typing_update( pub fn last_typing_update(
&self, &self,
room_id: &RoomId, room_id: &RoomId,
@ -339,6 +342,7 @@ impl RoomEdus {
} }
/// Resets the presence timeout, so the user will stay in their current presence state. /// Resets the presence timeout, so the user will stay in their current presence state.
#[tracing::instrument(skip(self))]
pub fn ping_presence(&self, user_id: &UserId) -> Result<()> { pub fn ping_presence(&self, user_id: &UserId) -> Result<()> {
self.userid_lastpresenceupdate.insert( self.userid_lastpresenceupdate.insert(
&user_id.to_string().as_bytes(), &user_id.to_string().as_bytes(),
@ -429,6 +433,7 @@ impl RoomEdus {
} }
/// Returns an iterator over the most recent presence updates that happened after the event with id `since`. /// Returns an iterator over the most recent presence updates that happened after the event with id `since`.
#[tracing::instrument(skip(self, globals, rooms))]
pub fn presence_since( pub fn presence_since(
&self, &self,
room_id: &RoomId, room_id: &RoomId,

84
src/database/sending.rs

@ -8,7 +8,8 @@ use std::{
use crate::{appservice_server, server_server, utils, Database, Error, PduEvent, Result}; use crate::{appservice_server, server_server, utils, Database, Error, PduEvent, Result};
use federation::transactions::send_transaction_message; use federation::transactions::send_transaction_message;
use log::info; use log::{info, warn};
use ring::digest;
use rocket::futures::stream::{FuturesUnordered, StreamExt}; use rocket::futures::stream::{FuturesUnordered, StreamExt};
use ruma::{ use ruma::{
api::{appservice, federation, OutgoingRequest}, api::{appservice, federation, OutgoingRequest},
@ -48,29 +49,59 @@ impl Sending {
let servernamepduids = self.servernamepduids.clone(); let servernamepduids = self.servernamepduids.clone();
let servercurrentpdus = self.servercurrentpdus.clone(); let servercurrentpdus = self.servercurrentpdus.clone();
let db = db.clone(); let db = db.clone();
let maximum_requests = self.maximum_requests.clone();
tokio::spawn(async move { tokio::spawn(async move {
let mut futures = FuturesUnordered::new(); let mut futures = FuturesUnordered::new();
// Retry requests we could not finish yet // Retry requests we could not finish yet
let mut current_transactions = HashMap::new(); let mut current_transactions = HashMap::<OutgoingKind, Vec<IVec>>::new();
for (outgoing_kind, pdu) in servercurrentpdus for (key, (kind, pdu)) in servercurrentpdus
.iter() .iter()
.filter_map(|r| r.ok()) .filter_map(|r| r.ok())
.filter_map(|(key, _)| Self::parse_servercurrentpdus(key).ok()) .filter_map(|(key, _)| Some((key, Self::parse_servercurrentpdus(key).ok()?)))
.filter(|(_, pdu)| !pdu.is_empty()) // Skip reservation key
.take(50)
// This should not contain more than 50 anyway
{ {
current_transactions if pdu.is_empty() {
.entry(outgoing_kind) // Remove old reservation key
.or_insert_with(Vec::new) servercurrentpdus.remove(key).unwrap();
.push(pdu); continue;
}
let entry = current_transactions.entry(kind).or_insert_with(Vec::new);
if entry.len() > 30 {
warn!("Dropping some current pdus because too many were queued. This should not happen.");
servercurrentpdus.remove(key).unwrap();
continue;
}
entry.push(pdu);
}
for (kind, pdus) in current_transactions {
// Create new reservation
let mut prefix = match &kind {
OutgoingKind::Appservice(server) => {
let mut p = b"+".to_vec();
p.extend_from_slice(server.as_bytes());
p
} }
OutgoingKind::Push(id) => {
let mut p = b"$".to_vec();
p.extend_from_slice(&id);
p
}
OutgoingKind::Normal(server) => {
let mut p = vec![];
p.extend_from_slice(server.as_bytes());
p
}
};
prefix.push(0xff);
servercurrentpdus.insert(prefix, &[]).unwrap();
for (outgoing_kind, pdus) in current_transactions { futures.push(Self::handle_event(kind, pdus, &db, &maximum_requests));
futures.push(Self::handle_event(outgoing_kind, pdus, &db));
} }
let mut last_failed_try: HashMap<OutgoingKind, (u32, Instant)> = HashMap::new(); let mut last_failed_try: HashMap<OutgoingKind, (u32, Instant)> = HashMap::new();
@ -119,7 +150,7 @@ impl Sending {
.map(|k| { .map(|k| {
k.subslice(prefix.len(), k.len() - prefix.len()) k.subslice(prefix.len(), k.len() - prefix.len())
}) })
.take(50) .take(30)
.collect::<Vec<_>>(); .collect::<Vec<_>>();
if !new_pdus.is_empty() { if !new_pdus.is_empty() {
@ -135,6 +166,7 @@ impl Sending {
outgoing_kind.clone(), outgoing_kind.clone(),
new_pdus, new_pdus,
&db, &db,
&maximum_requests,
) )
); );
} else { } else {
@ -243,9 +275,11 @@ impl Sending {
}; };
prefix.push(0xff); prefix.push(0xff);
servercurrentpdus if servercurrentpdus
.compare_and_swap(prefix, Option::<&[u8]>::None, Some(&[])) // Try to reserve .compare_and_swap(prefix, Option::<&[u8]>::None, Some(&[])) // Try to reserve
== Ok(Ok(())) == Ok(Ok(())) { true } else {
false
}
}) })
{ {
servercurrentpdus.insert(&key, &[]).unwrap(); servercurrentpdus.insert(&key, &[]).unwrap();
@ -256,6 +290,7 @@ impl Sending {
outgoing_kind, outgoing_kind,
vec![pdu_id.into()], vec![pdu_id.into()],
&db, &db,
&maximum_requests
) )
); );
} }
@ -282,6 +317,7 @@ impl Sending {
Ok(()) Ok(())
} }
#[tracing::instrument(skip(self))]
pub fn send_pdu(&self, server: &ServerName, pdu_id: &[u8]) -> Result<()> { pub fn send_pdu(&self, server: &ServerName, pdu_id: &[u8]) -> Result<()> {
let mut key = server.as_bytes().to_vec(); let mut key = server.as_bytes().to_vec();
key.push(0xff); key.push(0xff);
@ -291,8 +327,9 @@ impl Sending {
Ok(()) Ok(())
} }
#[tracing::instrument(skip(self))]
pub fn send_pdu_appservice(&self, appservice_id: &str, pdu_id: &[u8]) -> Result<()> { pub fn send_pdu_appservice(&self, appservice_id: &str, pdu_id: &[u8]) -> Result<()> {
let mut key = "+".as_bytes().to_vec(); let mut key = b"+".to_vec();
key.extend_from_slice(appservice_id.as_bytes()); key.extend_from_slice(appservice_id.as_bytes());
key.push(0xff); key.push(0xff);
key.extend_from_slice(pdu_id); key.extend_from_slice(pdu_id);
@ -301,11 +338,20 @@ impl Sending {
Ok(()) Ok(())
} }
// TODO this is the whole DB but is it better to clone smaller parts than the whole thing?? #[tracing::instrument]
fn calculate_hash(keys: &[IVec]) -> Vec<u8> {
// We only hash the pdu's event ids, not the whole pdu
let bytes = keys.join(&0xff);
let hash = digest::digest(&digest::SHA256, &bytes);
hash.as_ref().to_owned()
}
#[tracing::instrument(skip(db))]
async fn handle_event( async fn handle_event(
kind: OutgoingKind, kind: OutgoingKind,
pdu_ids: Vec<IVec>, pdu_ids: Vec<IVec>,
db: &Database, db: &Database,
maximum_requests: &Semaphore,
) -> std::result::Result<OutgoingKind, (OutgoingKind, Error)> { ) -> std::result::Result<OutgoingKind, (OutgoingKind, Error)> {
match kind { match kind {
OutgoingKind::Appservice(server) => { OutgoingKind::Appservice(server) => {
@ -523,6 +569,7 @@ impl Sending {
}) })
} }
#[tracing::instrument(skip(self, globals))]
pub async fn send_federation_request<T: OutgoingRequest>( pub async fn send_federation_request<T: OutgoingRequest>(
&self, &self,
globals: &crate::database::globals::Globals, globals: &crate::database::globals::Globals,
@ -539,6 +586,7 @@ impl Sending {
response response
} }
#[tracing::instrument(skip(self, globals))]
pub async fn send_appservice_request<T: OutgoingRequest>( pub async fn send_appservice_request<T: OutgoingRequest>(
&self, &self,
globals: &crate::database::globals::Globals, globals: &crate::database::globals::Globals,

5
src/database/users.rs

@ -311,6 +311,7 @@ impl Users {
Ok(()) Ok(())
} }
#[tracing::instrument(skip(self))]
pub fn last_one_time_keys_update(&self, user_id: &UserId) -> Result<u64> { pub fn last_one_time_keys_update(&self, user_id: &UserId) -> Result<u64> {
self.userid_lastonetimekeyupdate self.userid_lastonetimekeyupdate
.get(&user_id.to_string().as_bytes())? .get(&user_id.to_string().as_bytes())?
@ -364,6 +365,7 @@ impl Users {
.transpose() .transpose()
} }
#[tracing::instrument(skip(self))]
pub fn count_one_time_keys( pub fn count_one_time_keys(
&self, &self,
user_id: &UserId, user_id: &UserId,
@ -563,6 +565,7 @@ impl Users {
Ok(()) Ok(())
} }
#[tracing::instrument(skip(self))]
pub fn keys_changed( pub fn keys_changed(
&self, &self,
user_or_room_id: &str, user_or_room_id: &str,
@ -738,6 +741,7 @@ impl Users {
Ok(()) Ok(())
} }
#[tracing::instrument(skip(self))]
pub fn get_to_device_events( pub fn get_to_device_events(
&self, &self,
user_id: &UserId, user_id: &UserId,
@ -760,6 +764,7 @@ impl Users {
Ok(events) Ok(events)
} }
#[tracing::instrument(skip(self))]
pub fn remove_to_device_events( pub fn remove_to_device_events(
&self, &self,
user_id: &UserId, user_id: &UserId,

72
src/error.rs

@ -1,18 +1,7 @@
use std::{
collections::HashMap,
sync::RwLock,
time::{Duration, Instant},
};
use log::error; use log::error;
use ruma::{ use ruma::api::client::{error::ErrorKind, r0::uiaa::UiaaInfo};
api::client::{error::ErrorKind, r0::uiaa::UiaaInfo},
events::room::message,
};
use thiserror::Error; use thiserror::Error;
use crate::{database::admin::AdminCommand, Database};
#[cfg(feature = "conduit_bin")] #[cfg(feature = "conduit_bin")]
use { use {
crate::RumaResponse, crate::RumaResponse,
@ -111,62 +100,3 @@ where
.respond_to(r) .respond_to(r)
} }
} }
pub struct ConduitLogger {
pub db: Database,
pub last_logs: RwLock<HashMap<String, Instant>>,
}
impl log::Log for ConduitLogger {
fn enabled(&self, _metadata: &log::Metadata<'_>) -> bool {
true
}
fn log(&self, record: &log::Record<'_>) {
let output = format!("{} - {}", record.level(), record.args());
if self.enabled(record.metadata())
&& (record
.module_path()
.map_or(false, |path| path.starts_with("conduit::"))
|| record
.module_path()
.map_or(true, |path| !path.starts_with("rocket::")) // Rockets logs are annoying
&& record.metadata().level() <= log::Level::Warn)
{
let first_line = output
.lines()
.next()
.expect("lines always returns one item");
eprintln!("{}", output);
let mute_duration = match record.metadata().level() {
log::Level::Error => Duration::from_secs(60 * 5), // 5 minutes
log::Level::Warn => Duration::from_secs(60 * 60 * 24), // A day
_ => Duration::from_secs(60 * 60 * 24 * 7), // A week
};
if self
.last_logs
.read()
.unwrap()
.get(first_line)
.map_or(false, |i| i.elapsed() < mute_duration)
// Don't post this log again for some time
{
return;
}
if let Ok(mut_last_logs) = &mut self.last_logs.try_write() {
mut_last_logs.insert(first_line.to_owned(), Instant::now());
}
self.db.admin.send(AdminCommand::SendMessage(
message::MessageEventContent::notice_plain(output),
));
}
}
fn flush(&self) {}
}

2
src/lib.rs

@ -1,3 +1,5 @@
#![allow(clippy::suspicious_else_formatting)]
pub mod appservice_server; pub mod appservice_server;
pub mod client_server; pub mod client_server;
mod database; mod database;

66
src/main.rs

@ -1,3 +1,4 @@
#![allow(clippy::suspicious_else_formatting)]
#![warn(rust_2018_idioms)] #![warn(rust_2018_idioms)]
pub mod appservice_server; pub mod appservice_server;
@ -11,25 +12,23 @@ mod push_rules;
mod ruma_wrapper; mod ruma_wrapper;
mod utils; mod utils;
use database::Config;
pub use database::Database; pub use database::Database;
pub use error::{ConduitLogger, Error, Result}; pub use error::{Error, Result};
pub use pdu::PduEvent; pub use pdu::PduEvent;
pub use rocket::State; pub use rocket::State;
use ruma::api::client::error::ErrorKind; use ruma::api::client::error::ErrorKind;
pub use ruma_wrapper::{ConduitResult, Ruma, RumaResponse}; pub use ruma_wrapper::{ConduitResult, Ruma, RumaResponse};
use log::LevelFilter; use rocket::figment::{
use rocket::{
catch, catchers,
fairing::AdHoc,
figment::{
providers::{Env, Format, Toml}, providers::{Env, Format, Toml},
Figment, Figment,
},
routes, Request,
}; };
use rocket::{catch, catchers, fairing::AdHoc, routes, Request};
use tracing::span;
use tracing_subscriber::{prelude::*, Registry};
fn setup_rocket() -> rocket::Rocket { fn setup_rocket() -> (rocket::Rocket, Config) {
// Force log level off, so we can use our own logger // Force log level off, so we can use our own logger
std::env::set_var("CONDUIT_LOG_LEVEL", "off"); std::env::set_var("CONDUIT_LOG_LEVEL", "off");
@ -43,7 +42,12 @@ fn setup_rocket() -> rocket::Rocket {
) )
.merge(Env::prefixed("CONDUIT_").global()); .merge(Env::prefixed("CONDUIT_").global());
rocket::custom(config) let parsed_config = config
.extract::<Config>()
.expect("It looks like your config is invalid. Please take a look at the error");
let parsed_config2 = parsed_config.clone();
let rocket = rocket::custom(config)
.mount( .mount(
"/", "/",
routes![ routes![
@ -94,7 +98,7 @@ fn setup_rocket() -> rocket::Rocket {
client_server::get_backup_key_sessions_route, client_server::get_backup_key_sessions_route,
client_server::get_backup_keys_route, client_server::get_backup_keys_route,
client_server::set_read_marker_route, client_server::set_read_marker_route,
client_server::set_receipt_route, client_server::create_receipt_route,
client_server::create_typing_event_route, client_server::create_typing_event_route,
client_server::create_room_route, client_server::create_room_route,
client_server::redact_event_route, client_server::redact_event_route,
@ -168,29 +172,41 @@ fn setup_rocket() -> rocket::Rocket {
bad_json_catcher bad_json_catcher
]) ])
.attach(AdHoc::on_attach("Config", |rocket| async { .attach(AdHoc::on_attach("Config", |rocket| async {
let config = rocket let data = Database::load_or_create(parsed_config2)
.figment()
.extract()
.expect("It looks like your config is invalid. Please take a look at the error");
let data = Database::load_or_create(config)
.await .await
.expect("config is valid"); .expect("config is valid");
data.sending.start_handler(&data); data.sending
log::set_boxed_logger(Box::new(ConduitLogger { .start_handler(&data.globals, &data.rooms, &data.appservice);
db: data.clone(),
last_logs: Default::default(),
}))
.unwrap();
log::set_max_level(LevelFilter::Info);
Ok(rocket.manage(data)) Ok(rocket.manage(data))
})) }));
(rocket, parsed_config)
} }
#[rocket::main] #[rocket::main]
async fn main() { async fn main() {
setup_rocket().launch().await.unwrap(); let (rocket, config) = setup_rocket();
if config.allow_jaeger {
let (tracer, _uninstall) = opentelemetry_jaeger::new_pipeline()
.with_service_name("conduit")
.install()
.unwrap();
let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);
Registry::default().with(telemetry).try_init().unwrap();
let root = span!(tracing::Level::INFO, "app_start", work_units = 2);
let _enter = root.enter();
rocket.launch().await.unwrap();
} else {
let root = span!(tracing::Level::INFO, "app_start", work_units = 2);
let _enter = root.enter();
rocket.launch().await.unwrap();
}
} }
#[catch(404)] #[catch(404)]

34
src/pdu.rs

@ -34,6 +34,7 @@ pub struct PduEvent {
} }
impl PduEvent { impl PduEvent {
#[tracing::instrument(skip(self))]
pub fn redact(&mut self, reason: &PduEvent) -> crate::Result<()> { pub fn redact(&mut self, reason: &PduEvent) -> crate::Result<()> {
self.unsigned.clear(); self.unsigned.clear();
@ -80,6 +81,7 @@ impl PduEvent {
Ok(()) Ok(())
} }
#[tracing::instrument(skip(self))]
pub fn to_sync_room_event(&self) -> Raw<AnySyncRoomEvent> { pub fn to_sync_room_event(&self) -> Raw<AnySyncRoomEvent> {
let mut json = json!({ let mut json = json!({
"content": self.content, "content": self.content,
@ -101,6 +103,7 @@ impl PduEvent {
} }
/// This only works for events that are also AnyRoomEvents. /// This only works for events that are also AnyRoomEvents.
#[tracing::instrument(skip(self))]
pub fn to_any_event(&self) -> Raw<AnyEvent> { pub fn to_any_event(&self) -> Raw<AnyEvent> {
let mut json = json!({ let mut json = json!({
"content": self.content, "content": self.content,
@ -122,6 +125,7 @@ impl PduEvent {
serde_json::from_value(json).expect("Raw::from_value always works") serde_json::from_value(json).expect("Raw::from_value always works")
} }
#[tracing::instrument(skip(self))]
pub fn to_room_event(&self) -> Raw<AnyRoomEvent> { pub fn to_room_event(&self) -> Raw<AnyRoomEvent> {
let mut json = json!({ let mut json = json!({
"content": self.content, "content": self.content,
@ -143,6 +147,7 @@ impl PduEvent {
serde_json::from_value(json).expect("Raw::from_value always works") serde_json::from_value(json).expect("Raw::from_value always works")
} }
#[tracing::instrument(skip(self))]
pub fn to_state_event(&self) -> Raw<AnyStateEvent> { pub fn to_state_event(&self) -> Raw<AnyStateEvent> {
let json = json!({ let json = json!({
"content": self.content, "content": self.content,
@ -158,20 +163,27 @@ impl PduEvent {
serde_json::from_value(json).expect("Raw::from_value always works") serde_json::from_value(json).expect("Raw::from_value always works")
} }
#[tracing::instrument(skip(self))]
pub fn to_sync_state_event(&self) -> Raw<AnySyncStateEvent> { pub fn to_sync_state_event(&self) -> Raw<AnySyncStateEvent> {
let json = json!({ let json = format!(
"content": self.content, r#"{{"content":{},"type":"{}","event_id":"{}","sender":"{}","origin_server_ts":{},"unsigned":{},"state_key":"{}"}}"#,
"type": self.kind, self.content,
"event_id": self.event_id, self.kind,
"sender": self.sender, self.event_id,
"origin_server_ts": self.origin_server_ts, self.sender,
"unsigned": self.unsigned, self.origin_server_ts,
"state_key": self.state_key, serde_json::to_string(&self.unsigned).expect("Map::to_string always works"),
}); self.state_key
.as_ref()
.expect("state events have state keys")
);
serde_json::from_value(json).expect("Raw::from_value always works") Raw::from_json(
serde_json::value::RawValue::from_string(json).expect("our string is valid json"),
)
} }
#[tracing::instrument(skip(self))]
pub fn to_stripped_state_event(&self) -> Raw<AnyStrippedStateEvent> { pub fn to_stripped_state_event(&self) -> Raw<AnyStrippedStateEvent> {
let json = json!({ let json = json!({
"content": self.content, "content": self.content,
@ -183,6 +195,7 @@ impl PduEvent {
serde_json::from_value(json).expect("Raw::from_value always works") serde_json::from_value(json).expect("Raw::from_value always works")
} }
#[tracing::instrument(skip(self))]
pub fn to_member_event(&self) -> Raw<StateEvent<MemberEventContent>> { pub fn to_member_event(&self) -> Raw<StateEvent<MemberEventContent>> {
let json = json!({ let json = json!({
"content": self.content, "content": self.content,
@ -200,6 +213,7 @@ impl PduEvent {
} }
/// This does not return a full `Pdu` it is only to satisfy ruma's types. /// This does not return a full `Pdu` it is only to satisfy ruma's types.
#[tracing::instrument]
pub fn convert_to_outgoing_federation_event( pub fn convert_to_outgoing_federation_event(
mut pdu_json: CanonicalJsonObject, mut pdu_json: CanonicalJsonObject,
) -> Raw<ruma::events::pdu::Pdu> { ) -> Raw<ruma::events::pdu::Pdu> {

4
src/ruma_wrapper.rs

@ -79,9 +79,7 @@ where
registration registration
.get("as_token") .get("as_token")
.and_then(|as_token| as_token.as_str()) .and_then(|as_token| as_token.as_str())
.map_or(false, |as_token| { .map_or(false, |as_token| token.as_deref() == Some(as_token))
dbg!(token.as_deref()) == dbg!(Some(as_token))
})
}) { }) {
match T::METADATA.authentication { match T::METADATA.authentication {
AuthScheme::AccessToken | AuthScheme::QueryOnlyAccessToken => { AuthScheme::AccessToken | AuthScheme::QueryOnlyAccessToken => {

87
src/server_server.rs

@ -1,6 +1,7 @@
use crate::{client_server, utils, ConduitResult, Database, Error, PduEvent, Result, Ruma}; use crate::{client_server, utils, ConduitResult, Database, Error, PduEvent, Result, Ruma};
use http::header::{HeaderValue, AUTHORIZATION, HOST}; use http::header::{HeaderValue, AUTHORIZATION, HOST};
use log::{info, warn}; use log::{info, warn};
use regex::Regex;
use rocket::{get, post, put, response::content::Json, State}; use rocket::{get, post, put, response::content::Json, State};
use ruma::{ use ruma::{
api::{ api::{
@ -17,6 +18,7 @@ use ruma::{
OutgoingRequest, OutgoingRequest,
}, },
directory::{IncomingFilter, IncomingRoomNetwork}, directory::{IncomingFilter, IncomingRoomNetwork},
events::EventType,
EventId, RoomId, ServerName, ServerSigningKeyId, UserId, EventId, RoomId, ServerName, ServerSigningKeyId, UserId,
}; };
use std::{ use std::{
@ -27,6 +29,7 @@ use std::{
time::{Duration, SystemTime}, time::{Duration, SystemTime},
}; };
#[tracing::instrument(skip(globals))]
pub async fn send_request<T: OutgoingRequest>( pub async fn send_request<T: OutgoingRequest>(
globals: &crate::database::globals::Globals, globals: &crate::database::globals::Globals,
destination: &ServerName, destination: &ServerName,
@ -193,6 +196,7 @@ where
} }
} }
#[tracing::instrument]
fn get_ip_with_port(destination_str: String) -> Option<String> { fn get_ip_with_port(destination_str: String) -> Option<String> {
if destination_str.parse::<SocketAddr>().is_ok() { if destination_str.parse::<SocketAddr>().is_ok() {
Some(destination_str) Some(destination_str)
@ -203,6 +207,7 @@ fn get_ip_with_port(destination_str: String) -> Option<String> {
} }
} }
#[tracing::instrument]
fn add_port_to_hostname(destination_str: String) -> String { fn add_port_to_hostname(destination_str: String) -> String {
match destination_str.find(':') { match destination_str.find(':') {
None => destination_str.to_owned() + ":8448", None => destination_str.to_owned() + ":8448",
@ -213,9 +218,10 @@ fn add_port_to_hostname(destination_str: String) -> String {
/// Returns: actual_destination, host header /// Returns: actual_destination, host header
/// Implemented according to the specification at https://matrix.org/docs/spec/server_server/r0.1.4#resolving-server-names /// Implemented according to the specification at https://matrix.org/docs/spec/server_server/r0.1.4#resolving-server-names
/// Numbers in comments below refer to bullet points in linked section of specification /// Numbers in comments below refer to bullet points in linked section of specification
pub(crate) async fn find_actual_destination( #[tracing::instrument(skip(globals))]
async fn find_actual_destination(
globals: &crate::database::globals::Globals, globals: &crate::database::globals::Globals,
destination: &ServerName, destination: &'_ ServerName,
) -> (String, Option<String>) { ) -> (String, Option<String>) {
let mut host = None; let mut host = None;
@ -271,9 +277,10 @@ pub(crate) async fn find_actual_destination(
(actual_destination, host) (actual_destination, host)
} }
async fn query_srv_record<'a>( #[tracing::instrument(skip(globals))]
async fn query_srv_record(
globals: &crate::database::globals::Globals, globals: &crate::database::globals::Globals,
hostname: &'a str, hostname: &'_ str,
) -> Option<String> { ) -> Option<String> {
if let Ok(Some(host_port)) = globals if let Ok(Some(host_port)) = globals
.dns_resolver() .dns_resolver()
@ -295,6 +302,7 @@ async fn query_srv_record<'a>(
} }
} }
#[tracing::instrument(skip(globals))]
pub async fn request_well_known( pub async fn request_well_known(
globals: &crate::database::globals::Globals, globals: &crate::database::globals::Globals,
destination: &str, destination: &str,
@ -318,6 +326,7 @@ pub async fn request_well_known(
} }
#[cfg_attr(feature = "conduit_bin", get("/_matrix/federation/v1/version"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/federation/v1/version"))]
#[tracing::instrument(skip(db))]
pub fn get_server_version_route( pub fn get_server_version_route(
db: State<'_, Database>, db: State<'_, Database>,
) -> ConduitResult<get_server_version::Response> { ) -> ConduitResult<get_server_version::Response> {
@ -335,6 +344,7 @@ pub fn get_server_version_route(
} }
#[cfg_attr(feature = "conduit_bin", get("/_matrix/key/v2/server"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/key/v2/server"))]
#[tracing::instrument(skip(db))]
pub fn get_server_keys_route(db: State<'_, Database>) -> Json<String> { pub fn get_server_keys_route(db: State<'_, Database>) -> Json<String> {
if !db.globals.allow_federation() { if !db.globals.allow_federation() {
// TODO: Use proper types // TODO: Use proper types
@ -377,6 +387,7 @@ pub fn get_server_keys_route(db: State<'_, Database>) -> Json<String> {
} }
#[cfg_attr(feature = "conduit_bin", get("/_matrix/key/v2/server/<_>"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/key/v2/server/<_>"))]
#[tracing::instrument(skip(db))]
pub fn get_server_keys_deprecated_route(db: State<'_, Database>) -> Json<String> { pub fn get_server_keys_deprecated_route(db: State<'_, Database>) -> Json<String> {
get_server_keys_route(db) get_server_keys_route(db)
} }
@ -385,6 +396,7 @@ pub fn get_server_keys_deprecated_route(db: State<'_, Database>) -> Json<String>
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/federation/v1/publicRooms", data = "<body>") post("/_matrix/federation/v1/publicRooms", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_public_rooms_filtered_route( pub async fn get_public_rooms_filtered_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_public_rooms_filtered::v1::Request<'_>>, body: Ruma<get_public_rooms_filtered::v1::Request<'_>>,
@ -432,6 +444,7 @@ pub async fn get_public_rooms_filtered_route(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/federation/v1/publicRooms", data = "<body>") get("/_matrix/federation/v1/publicRooms", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn get_public_rooms_route( pub async fn get_public_rooms_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_public_rooms::v1::Request<'_>>, body: Ruma<get_public_rooms::v1::Request<'_>>,
@ -479,6 +492,7 @@ pub async fn get_public_rooms_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/federation/v1/send/<_>", data = "<body>") put("/_matrix/federation/v1/send/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub async fn send_transaction_message_route<'a>( pub async fn send_transaction_message_route<'a>(
db: State<'a, Database>, db: State<'a, Database>,
body: Ruma<send_transaction_message::v1::Request<'_>>, body: Ruma<send_transaction_message::v1::Request<'_>>,
@ -564,9 +578,70 @@ pub async fn send_transaction_message_route<'a>(
db.rooms.set_room_state(&room_id, &next_room_state)?; db.rooms.set_room_state(&room_id, &next_room_state)?;
for appservice in db.appservice.iter_all().filter_map(|r| r.ok()) { for appservice in db.appservice.iter_all().filter_map(|r| r.ok()) {
if let Some(namespaces) = appservice.1.get("namespaces") {
let users = namespaces
.get("users")
.and_then(|users| users.as_sequence())
.map_or_else(
|| Vec::new(),
|users| {
users
.iter()
.map(|users| {
users
.get("regex")
.and_then(|regex| regex.as_str())
.and_then(|regex| Regex::new(regex).ok())
})
.filter_map(|o| o)
.collect::<Vec<_>>()
},
);
let aliases = namespaces
.get("aliases")
.and_then(|users| users.get("regex"))
.and_then(|regex| regex.as_str())
.and_then(|regex| Regex::new(regex).ok());
let rooms = namespaces
.get("rooms")
.and_then(|rooms| rooms.as_sequence());
let room_aliases = db.rooms.room_aliases(&room_id);
let bridge_user_id = appservice
.1
.get("sender_localpart")
.and_then(|string| string.as_str())
.and_then(|string| {
UserId::parse_with_server_name(string, db.globals.server_name()).ok()
});
if bridge_user_id.map_or(false, |bridge_user_id| {
db.rooms
.is_joined(&bridge_user_id, room_id)
.unwrap_or(false)
}) || users.iter().any(|users| {
users.is_match(pdu.sender.as_str())
|| pdu.kind == EventType::RoomMember
&& pdu
.state_key
.as_ref()
.map_or(false, |state_key| users.is_match(&state_key))
}) || aliases.map_or(false, |aliases| {
room_aliases
.filter_map(|r| r.ok())
.any(|room_alias| aliases.is_match(room_alias.as_str()))
}) || rooms.map_or(false, |rooms| rooms.contains(&room_id.as_str().into()))
|| db
.rooms
.room_members(&room_id)
.filter_map(|r| r.ok())
.any(|member| users.iter().any(|regex| regex.is_match(member.as_str())))
{
db.sending.send_pdu_appservice(&appservice.0, &pdu_id)?; db.sending.send_pdu_appservice(&appservice.0, &pdu_id)?;
} }
}
}
resolved_map.insert(event_id, Ok::<(), String>(())); resolved_map.insert(event_id, Ok::<(), String>(()));
} }
@ -577,6 +652,7 @@ pub async fn send_transaction_message_route<'a>(
feature = "conduit_bin", feature = "conduit_bin",
post("/_matrix/federation/v1/get_missing_events/<_>", data = "<body>") post("/_matrix/federation/v1/get_missing_events/<_>", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub fn get_missing_events_route<'a>( pub fn get_missing_events_route<'a>(
db: State<'a, Database>, db: State<'a, Database>,
body: Ruma<get_missing_events::v1::Request<'_>>, body: Ruma<get_missing_events::v1::Request<'_>>,
@ -622,6 +698,7 @@ pub fn get_missing_events_route<'a>(
feature = "conduit_bin", feature = "conduit_bin",
get("/_matrix/federation/v1/query/profile", data = "<body>") get("/_matrix/federation/v1/query/profile", data = "<body>")
)] )]
#[tracing::instrument(skip(db, body))]
pub fn get_profile_information_route<'a>( pub fn get_profile_information_route<'a>(
db: State<'a, Database>, db: State<'a, Database>,
body: Ruma<get_profile_information::v1::Request<'_>>, body: Ruma<get_profile_information::v1::Request<'_>>,

1
src/utils.rs

@ -55,6 +55,7 @@ pub fn random_string(length: usize) -> String {
thread_rng() thread_rng()
.sample_iter(&rand::distributions::Alphanumeric) .sample_iter(&rand::distributions::Alphanumeric)
.take(length) .take(length)
.map(char::from)
.collect() .collect()
} }

2
tests/Complement.Dockerfile

@ -9,7 +9,7 @@ ARG SCCACHE_ENDPOINT
ARG SCCACHE_S3_USE_SSL ARG SCCACHE_S3_USE_SSL
COPY . . COPY . .
RUN test -e target/release/conduit || cargo build --release --offline RUN test -e cached_target/release/conduit || cargo build --release
FROM valkum/docker-rust-ci:latest FROM valkum/docker-rust-ci:latest
WORKDIR /workdir WORKDIR /workdir

78
tests/sytest/are-we-synapse-yet.list

@ -91,14 +91,15 @@ snd PUT /rooms/:room_id/send/:event_type/:txn_id deduplicates the same txn id
get GET /rooms/:room_id/messages returns a message get GET /rooms/:room_id/messages returns a message
get GET /rooms/:room_id/messages lazy loads members correctly get GET /rooms/:room_id/messages lazy loads members correctly
typ PUT /rooms/:room_id/typing/:user_id sets typing notification typ PUT /rooms/:room_id/typing/:user_id sets typing notification
typ Typing notifications don't leak (3 subtests)
rst GET /rooms/:room_id/state/m.room.power_levels can fetch levels rst GET /rooms/:room_id/state/m.room.power_levels can fetch levels
rst PUT /rooms/:room_id/state/m.room.power_levels can set levels rst PUT /rooms/:room_id/state/m.room.power_levels can set levels
rst PUT power_levels should not explode if the old power levels were empty rst PUT power_levels should not explode if the old power levels were empty
rst Both GET and PUT work rst Both GET and PUT work
rct POST /rooms/:room_id/receipt can create receipts rct POST /rooms/:room_id/receipt can create receipts
red POST /rooms/:room_id/read_markers can create read marker red POST /rooms/:room_id/read_markers can create read marker
med POST /media/v1/upload can create an upload med POST /media/r0/upload can create an upload
med GET /media/v1/download can fetch the value again med GET /media/r0/download can fetch the value again
cap GET /capabilities is present and well formed for registered user cap GET /capabilities is present and well formed for registered user
cap GET /r0/capabilities is not public cap GET /r0/capabilities is not public
reg Register with a recaptcha reg Register with a recaptcha
@ -296,7 +297,7 @@ fgt Forgotten room messages cannot be paginated
fgt Forgetting room does not show up in v2 /sync fgt Forgetting room does not show up in v2 /sync
fgt Can forget room you've been kicked from fgt Can forget room you've been kicked from
fgt Can't forget room you're still in fgt Can't forget room you're still in
mem Can re-join room if re-invited fgt Can re-join room if re-invited
ath Only original members of the room can see messages from erased users ath Only original members of the room can see messages from erased users
mem /joined_rooms returns only joined rooms mem /joined_rooms returns only joined rooms
mem /joined_members return joined members mem /joined_members return joined members
@ -455,6 +456,19 @@ rmv User can invite remote user to room with version 5
rmv Remote user can backfill in a room with version 5 rmv Remote user can backfill in a room with version 5
rmv Can reject invites over federation for rooms with version 5 rmv Can reject invites over federation for rooms with version 5
rmv Can receive redactions from regular users over federation in room version 5 rmv Can receive redactions from regular users over federation in room version 5
rmv User can create and send/receive messages in a room with version 6
rmv User can create and send/receive messages in a room with version 6 (2 subtests)
rmv local user can join room with version 6
rmv User can invite local user to room with version 6
rmv remote user can join room with version 6
rmv User can invite remote user to room with version 6
rmv Remote user can backfill in a room with version 6
rmv Can reject invites over federation for rooms with version 6
rmv Can receive redactions from regular users over federation in room version 6
rmv Inbound federation rejects invites which include invalid JSON for room version 6
rmv Outbound federation rejects invite response which include invalid JSON for room version 6
rmv Inbound federation rejects invite rejections which include invalid JSON for room version 6
rmv Server rejects invalid JSON in a version 6 room
pre Presence changes are reported to local room members pre Presence changes are reported to local room members
f,pre Presence changes are also reported to remote room members f,pre Presence changes are also reported to remote room members
pre Presence changes to UNAVAILABLE are reported to local room members pre Presence changes to UNAVAILABLE are reported to local room members
@ -482,24 +496,24 @@ f,dvk If remote user leaves room, changes device and rejoins we see update in /k
dvk Get left notifs in sync and /keys/changes when other user leaves dvk Get left notifs in sync and /keys/changes when other user leaves
dvk Get left notifs for other users in sync and /keys/changes when user leaves dvk Get left notifs for other users in sync and /keys/changes when user leaves
f,dvk If user leaves room, remote user changes device and rejoins we see update in /sync and /keys/changes f,dvk If user leaves room, remote user changes device and rejoins we see update in /sync and /keys/changes
dvk Can create backup version dkb Can create backup version
dvk Can update backup version dkb Can update backup version
dvk Responds correctly when backup is empty dkb Responds correctly when backup is empty
dvk Can backup keys dkb Can backup keys
dvk Can update keys with better versions dkb Can update keys with better versions
dvk Will not update keys with worse versions dkb Will not update keys with worse versions
dvk Will not back up to an old backup version dkb Will not back up to an old backup version
dvk Can delete backup dkb Can delete backup
dvk Deleted & recreated backups are empty dkb Deleted & recreated backups are empty
dvk Can create more than 10 backup versions dkb Can create more than 10 backup versions
dvk Can upload self-signing keys xsk Can upload self-signing keys
dvk Fails to upload self-signing keys with no auth xsk Fails to upload self-signing keys with no auth
dvk Fails to upload self-signing key without master key xsk Fails to upload self-signing key without master key
dvk Changing master key notifies local users xsk Changing master key notifies local users
dvk Changing user-signing key notifies local users xsk Changing user-signing key notifies local users
f,dvk can fetch self-signing keys over federation f,xsk can fetch self-signing keys over federation
f,dvk uploading self-signing key notifies over federation f,xsk uploading self-signing key notifies over federation
f,dvk uploading signed devices gets propagated over federation f,xsk uploading signed devices gets propagated over federation
tag Can add tag tag Can add tag
tag Can remove tag tag Can remove tag
tag Can list tags for a room tag Can list tags for a room
@ -536,11 +550,11 @@ std Can recv device messages until they are acknowledged
std Device messages with the same txn_id are deduplicated std Device messages with the same txn_id are deduplicated
std Device messages wake up /sync std Device messages wake up /sync
std Can recv device messages over federation std Can recv device messages over federation
std Device messages over federation wake up /sync fsd Device messages over federation wake up /sync
std Can send messages with a wildcard device id std Can send messages with a wildcard device id
std Can send messages with a wildcard device id to two devices std Can send messages with a wildcard device id to two devices
std Wildcard device messages wake up /sync std Wildcard device messages wake up /sync
std Wildcard device messages over federation wake up /sync fsd Wildcard device messages over federation wake up /sync
adm /whois adm /whois
nsp /purge_history nsp /purge_history
nsp /purge_history by ts nsp /purge_history by ts
@ -578,6 +592,7 @@ frv A pair of servers can establish a join in a v2 room
fsj Outbound federation rejects send_join responses with no m.room.create event fsj Outbound federation rejects send_join responses with no m.room.create event
frv Outbound federation rejects m.room.create events with an unknown room version frv Outbound federation rejects m.room.create events with an unknown room version
fsj Event with an invalid signature in the send_join response should not cause room join to fail fsj Event with an invalid signature in the send_join response should not cause room join to fail
fsj Inbound: send_join rejects invalid JSON for room version 6
fed Outbound federation can send events fed Outbound federation can send events
fed Inbound federation can receive events fed Inbound federation can receive events
fed Inbound federation can receive redacted events fed Inbound federation can receive redacted events
@ -636,6 +651,7 @@ fst Name/topic keys are correct
fau Remote servers cannot set power levels in rooms without existing powerlevels fau Remote servers cannot set power levels in rooms without existing powerlevels
fau Remote servers should reject attempts by non-creators to set the power levels fau Remote servers should reject attempts by non-creators to set the power levels
fau Inbound federation rejects typing notifications from wrong remote fau Inbound federation rejects typing notifications from wrong remote
fau Users cannot set notifications powerlevel higher than their own
fed Forward extremities remain so even after the next events are populated as outliers fed Forward extremities remain so even after the next events are populated as outliers
fau Banned servers cannot send events fau Banned servers cannot send events
fau Banned servers cannot /make_join fau Banned servers cannot /make_join
@ -815,6 +831,7 @@ psh Trying to get push rules with unknown scope fails with 400
psh Trying to get push rules with unknown template fails with 400 psh Trying to get push rules with unknown template fails with 400
psh Trying to get push rules with unknown attribute fails with 400 psh Trying to get push rules with unknown attribute fails with 400
psh Trying to get push rules with unknown rule_id fails with 404 psh Trying to get push rules with unknown rule_id fails with 404
psh Rooms with names are correctly named in pushes
v1s GET /initialSync with non-numeric 'limit' v1s GET /initialSync with non-numeric 'limit'
v1s GET /events with non-numeric 'limit' v1s GET /events with non-numeric 'limit'
v1s GET /events with negative 'limit' v1s GET /events with negative 'limit'
@ -823,7 +840,7 @@ ath Event size limits
syn Check creating invalid filters returns 4xx syn Check creating invalid filters returns 4xx
f,pre New federated private chats get full presence information (SYN-115) f,pre New federated private chats get full presence information (SYN-115)
pre Left room members do not cause problems for presence pre Left room members do not cause problems for presence
crm Rooms can be created with an initial invite list (SYN-205) crm Rooms can be created with an initial invite list (SYN-205) (1 subtests)
typ Typing notifications don't leak typ Typing notifications don't leak
ban Non-present room members cannot ban others ban Non-present room members cannot ban others
psh Getting push rules doesn't corrupt the cache SYN-390 psh Getting push rules doesn't corrupt the cache SYN-390
@ -834,3 +851,16 @@ gst Real user can call /events on another world_readable room (SYN-606)
gst Events come down the correct room gst Events come down the correct room
pub Asking for a remote rooms list, but supplying the local server's name, returns the local rooms list pub Asking for a remote rooms list, but supplying the local server's name, returns the local rooms list
std Can send a to-device message to two users which both receive it using /sync std Can send a to-device message to two users which both receive it using /sync
fme Outbound federation will ignore a missing event with bad JSON for room version 6
fbk Outbound federation rejects backfill containing invalid JSON for events in room version 6
jso Invalid JSON integers
jso Invalid JSON floats
jso Invalid JSON special values
inv Can invite users to invite-only rooms (2 subtests)
plv setting 'm.room.name' respects room powerlevel (2 subtests)
psh Messages that notify from another user increment notification_count
psh Messages that org.matrix.msc2625.mark_unread from another user increment org.matrix.msc2625.unread_count
dvk Can claim one time key using POST (2 subtests)
fdk Can query remote device keys using POST (1 subtests)
fdk Can claim remote one time key using POST (2 subtests)
fmj Inbound /make_join rejects attempts to join rooms where all users have left

28
tests/sytest/are-we-synapse-yet.py

@ -33,6 +33,8 @@ import sys
test_mappings = { test_mappings = {
"nsp": "Non-Spec API", "nsp": "Non-Spec API",
"unk": "Unknown API (no group specified)",
"app": "Application Services API",
"f": "Federation", # flag to mark test involves federation "f": "Federation", # flag to mark test involves federation
"federation_apis": { "federation_apis": {
@ -50,6 +52,7 @@ test_mappings = {
"fpb": "Public Room API", "fpb": "Public Room API",
"fdk": "Device Key APIs", "fdk": "Device Key APIs",
"fed": "Federation API", "fed": "Federation API",
"fsd": "Send-to-Device APIs",
}, },
"client_apis": { "client_apis": {
@ -61,6 +64,8 @@ test_mappings = {
"pro": "Profile", "pro": "Profile",
"dev": "Devices", "dev": "Devices",
"dvk": "Device Keys", "dvk": "Device Keys",
"dkb": "Device Key Backup",
"xsk": "Cross-signing Keys",
"pre": "Presence", "pre": "Presence",
"crm": "Create Room", "crm": "Create Room",
"syn": "Sync API", "syn": "Sync API",
@ -98,7 +103,7 @@ test_mappings = {
"adm": "Server Admin API", "adm": "Server Admin API",
"ign": "Ignore Users", "ign": "Ignore Users",
"udr": "User Directory APIs", "udr": "User Directory APIs",
"app": "Application Services API", "jso": "Enforced canonical JSON",
}, },
} }
@ -156,6 +161,8 @@ def print_stats(header_name, gid_to_tests, gid_to_name, verbose):
total_tests = 0 total_tests = 0
for gid, tests in gid_to_tests.items(): for gid, tests in gid_to_tests.items():
group_total = len(tests) group_total = len(tests)
if group_total == 0:
continue
group_passing = 0 group_passing = 0
test_names_and_marks = [] test_names_and_marks = []
for name, passing in tests.items(): for name, passing in tests.items():
@ -186,7 +193,6 @@ def main(results_tap_path, verbose):
test_name_to_group_id = {} test_name_to_group_id = {}
fed_tests = set() fed_tests = set()
client_tests = set() client_tests = set()
groupless_tests = set()
with open("./are-we-synapse-yet.list", "r") as f: with open("./are-we-synapse-yet.list", "r") as f:
for line in f.readlines(): for line in f.readlines():
test_name = " ".join(line.split(" ")[1:]).strip() test_name = " ".join(line.split(" ")[1:]).strip()
@ -212,8 +218,12 @@ def main(results_tap_path, verbose):
# test_name: OK # test_name: OK
# } # }
}, },
"appservice": {
"app": {},
},
"nonspec": { "nonspec": {
"nsp": {} "nsp": {},
"unk": {}
}, },
} }
with open(results_tap_path, "r") as f: with open(results_tap_path, "r") as f:
@ -224,10 +234,11 @@ def main(results_tap_path, verbose):
name = test_result["name"] name = test_result["name"]
group_id = test_name_to_group_id.get(name) group_id = test_name_to_group_id.get(name)
if not group_id: if not group_id:
groupless_tests.add(name) summary["nonspec"]["unk"][name] = test_result["ok"]
# raise Exception("The test '%s' doesn't have a group" % (name,))
if group_id == "nsp": if group_id == "nsp":
summary["nonspec"]["nsp"][name] = test_result["ok"] summary["nonspec"]["nsp"][name] = test_result["ok"]
elif group_id == "app":
summary["appservice"]["app"][name] = test_result["ok"]
elif group_id in test_mappings["federation_apis"]: elif group_id in test_mappings["federation_apis"]:
group = summary["federation"].get(group_id, {}) group = summary["federation"].get(group_id, {})
group[name] = test_result["ok"] group[name] = test_result["ok"]
@ -243,12 +254,7 @@ def main(results_tap_path, verbose):
print_stats("Non-Spec APIs", summary["nonspec"], test_mappings, verbose) print_stats("Non-Spec APIs", summary["nonspec"], test_mappings, verbose)
print_stats("Client-Server APIs", summary["client"], test_mappings["client_apis"], verbose) print_stats("Client-Server APIs", summary["client"], test_mappings["client_apis"], verbose)
print_stats("Federation APIs", summary["federation"], test_mappings["federation_apis"], verbose) print_stats("Federation APIs", summary["federation"], test_mappings["federation_apis"], verbose)
if verbose: print_stats("Application Services APIs", summary["appservice"], test_mappings, verbose)
print("The following tests don't have a group:")
for name in groupless_tests:
print(" %s" % (name,))
else:
print("%d tests don't have a group" % len(groupless_tests))

Loading…
Cancel
Save