Compare commits
4 Commits
274b9ab0ca
...
2bd9fbaa9c
Author | SHA1 | Date |
---|---|---|
Flori | 2bd9fbaa9c | |
bitfl0wer | f2f45b4b86 | |
Flori | 582173234f | |
bitfl0wer | 7bba7c6fcb |
|
@ -1227,13 +1227,14 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mio"
|
name = "mio"
|
||||||
version = "0.8.11"
|
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 = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
|
checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"hermit-abi",
|
||||||
"libc",
|
"libc",
|
||||||
"wasi",
|
"wasi",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1345,16 +1346,6 @@ dependencies = [
|
||||||
"libm",
|
"libm",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num_cpus"
|
|
||||||
version = "1.16.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
|
|
||||||
dependencies = [
|
|
||||||
"hermit-abi",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "object"
|
name = "object"
|
||||||
version = "0.36.1"
|
version = "0.36.1"
|
||||||
|
@ -1597,9 +1588,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pubserve"
|
name = "pubserve"
|
||||||
version = "1.1.0-alpha.1"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b1781b2a51798c98a381e839e61bc5ce6426bd89bb9c3f9142de2086a80591cd"
|
checksum = "6a2cf5f495fc9c61de736666ebcbc473fe28a2a1aaf7e5619e5925b13c0275a4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
]
|
]
|
||||||
|
@ -1972,9 +1963,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_with"
|
name = "serde_with"
|
||||||
version = "3.8.3"
|
version = "3.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e73139bc5ec2d45e6c5fd85be5a46949c1c39a4c18e56915f5eb4c12f975e377"
|
checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -1990,9 +1981,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_with_macros"
|
name = "serde_with_macros"
|
||||||
version = "3.8.3"
|
version = "3.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b80d3d6b56b64335c0180e5ffde23b3c5e08c14c585b51a15bd0e95393f46703"
|
checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -2412,18 +2403,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.61"
|
version = "1.0.63"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
|
checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.61"
|
version = "1.0.63"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
|
checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -2478,26 +2469,25 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.38.0"
|
version = "1.39.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
|
checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"bytes",
|
"bytes",
|
||||||
"libc",
|
"libc",
|
||||||
"mio",
|
"mio",
|
||||||
"num_cpus",
|
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"socket2",
|
"socket2",
|
||||||
"tokio-macros",
|
"tokio-macros",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-macros"
|
name = "tokio-macros"
|
||||||
version = "2.3.0"
|
version = "2.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
|
checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
42
Cargo.toml
42
Cargo.toml
|
@ -22,33 +22,33 @@ voice_udp = ["dep:discortp", "dep:crypto_secretbox"]
|
||||||
voice_gateway = []
|
voice_gateway = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tokio = { version = "1.35.1", features = ["macros", "sync"] }
|
tokio = { version = "1.38.1", features = ["macros", "sync"] }
|
||||||
serde = { version = "1.0.195", features = ["derive", "rc"] }
|
serde = { version = "1.0.204", features = ["derive", "rc"] }
|
||||||
serde_json = { version = "1.0.111", features = ["raw_value"] }
|
serde_json = { version = "1.0.120", features = ["raw_value"] }
|
||||||
serde-aux = "4.3.1"
|
serde-aux = "4.5.0"
|
||||||
serde_with = "3.4.0"
|
serde_with = "3.9.0"
|
||||||
serde_repr = "0.1.18"
|
serde_repr = "0.1.19"
|
||||||
reqwest = { features = [
|
reqwest = { features = [
|
||||||
"multipart",
|
"multipart",
|
||||||
"json",
|
"json",
|
||||||
"rustls-tls-webpki-roots",
|
"rustls-tls-webpki-roots",
|
||||||
], version = "=0.11.26", default-features = false }
|
], version = "=0.11.26", default-features = false }
|
||||||
url = "2.5.0"
|
url = "2.5.2"
|
||||||
chrono = { version = "0.4.31", features = ["serde"] }
|
chrono = { version = "0.4.38", features = ["serde"] }
|
||||||
regex = "1.10.2"
|
regex = "1.10.5"
|
||||||
custom_error = "1.9.2"
|
custom_error = "1.9.2"
|
||||||
futures-util = "0.3.30"
|
futures-util = "0.3.30"
|
||||||
http = "0.2.12"
|
http = "0.2.12"
|
||||||
base64 = "0.21.7"
|
base64 = "0.21.7"
|
||||||
bitflags = { version = "2.4.1", features = ["serde"] }
|
bitflags = { version = "2.6.0", features = ["serde"] }
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.5.0"
|
||||||
poem = { version = "3.0.1", features = ["multipart"], optional = true }
|
poem = { version = "3.0.1", features = ["multipart"], optional = true }
|
||||||
thiserror = "1.0.56"
|
thiserror = "1.0.63"
|
||||||
jsonwebtoken = "8.3.0"
|
jsonwebtoken = "8.3.0"
|
||||||
log = "0.4.20"
|
log = "0.4.22"
|
||||||
async-trait = "0.1.77"
|
async-trait = "0.1.81"
|
||||||
chorus-macros = { path = "./chorus-macros", version = "0" } # Note: version here is used when releasing. This will use the latest release. Make sure to republish the crate when code in macros is changed!
|
chorus-macros = { path = "./chorus-macros", version = "0" } # Note: version here is used when releasing. This will use the latest release. Make sure to republish the crate when code in macros is changed!
|
||||||
sqlx = { version = "0.7.3", features = [
|
sqlx = { version = "0.7.4", features = [
|
||||||
"mysql",
|
"mysql",
|
||||||
"sqlite",
|
"sqlite",
|
||||||
"json",
|
"json",
|
||||||
|
@ -66,24 +66,24 @@ crypto_secretbox = { version = "0.1.1", optional = true }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
flate2 = { version = "1.0.30", optional = true }
|
flate2 = { version = "1.0.30", optional = true }
|
||||||
webpki-roots = "0.26.3"
|
webpki-roots = "0.26.3"
|
||||||
pubserve = { version = "1.1.0-alpha.1", features = ["async", "send"] }
|
pubserve = { version = "1.1.0", features = ["async", "send"] }
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
rustls = "0.21.10"
|
rustls = "0.21.12"
|
||||||
tokio-tungstenite = { version = "0.20.1", features = [
|
tokio-tungstenite = { version = "0.20.1", features = [
|
||||||
"rustls-tls-webpki-roots",
|
"rustls-tls-webpki-roots",
|
||||||
] }
|
] }
|
||||||
hostname = "0.3.1"
|
hostname = "0.3.1"
|
||||||
getrandom = { version = "0.2.12" }
|
getrandom = { version = "0.2.15" }
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
getrandom = { version = "0.2.12", features = ["js"] }
|
getrandom = { version = "0.2.15", features = ["js"] }
|
||||||
ws_stream_wasm = "0.7.4"
|
ws_stream_wasm = "0.7.4"
|
||||||
wasm-bindgen-futures = "0.4.39"
|
wasm-bindgen-futures = "0.4.42"
|
||||||
wasmtimer = "0.2.0"
|
wasmtimer = "0.2.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.5.0"
|
||||||
wasm-bindgen-test = "0.3.42"
|
wasm-bindgen-test = "0.3.42"
|
||||||
wasm-bindgen = "0.2.92"
|
wasm-bindgen = "0.2.92"
|
||||||
simple_logger = { version = "5.0.0", default-features = false }
|
simple_logger = { version = "5.0.0", default-features = false }
|
||||||
|
|
|
@ -5,14 +5,52 @@
|
||||||
use crate::types::events::WebSocketEvent;
|
use crate::types::events::WebSocketEvent;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, WebSocketEvent, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(
|
||||||
|
Debug, Deserialize, Serialize, WebSocketEvent, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord,
|
||||||
|
)]
|
||||||
pub struct GatewayHeartbeat {
|
pub struct GatewayHeartbeat {
|
||||||
pub op: u8,
|
pub op: u8,
|
||||||
pub d: Option<u64>,
|
pub d: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, WebSocketEvent, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
impl GatewayHeartbeat {
|
||||||
|
/// The Heartbeat packet a server would receive from a new or fresh Gateway connection.
|
||||||
|
pub fn first() -> Self {
|
||||||
|
Self::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Quickly create a [GatewayHeartbeat] with the correct `opcode` and the given `sequence_number`.
|
||||||
|
///
|
||||||
|
/// Shorthand for
|
||||||
|
/// ```rs
|
||||||
|
/// Self {
|
||||||
|
/// op: 1,
|
||||||
|
/// d: Some(sequence_number)
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
pub fn new(sequence_number: u64) -> Self {
|
||||||
|
Self {
|
||||||
|
op: 1,
|
||||||
|
d: Some(sequence_number),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::default::Default for GatewayHeartbeat {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self { op: 1, d: None }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(
|
||||||
|
Debug, Deserialize, Serialize, Clone, WebSocketEvent, Copy, PartialEq, Eq, Hash, PartialOrd, Ord,
|
||||||
|
)]
|
||||||
pub struct GatewayHeartbeatAck {
|
pub struct GatewayHeartbeatAck {
|
||||||
pub op: i32,
|
pub op: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::default::Default for GatewayHeartbeatAck {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self { op: 11 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue