Skip to content

Commit

Permalink
feat(RESTful): support kick user, list detailed online users and Bear…
Browse files Browse the repository at this point in the history
…er authorization
  • Loading branch information
Itsusinn committed Sep 15, 2024
1 parent 351bedd commit 2015dcf
Show file tree
Hide file tree
Showing 6 changed files with 213 additions and 16 deletions.
120 changes: 118 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resolver = "2"
[workspace.package]
authors = ["EAimTY <[email protected]>"]
version = "1.1.1"
rust-version = "1.65.0"
rust-version = "1.80.0"
edition = "2021"
readme = "README.md"
license = "GPL-3.0-or-later"
Expand Down
1 change: 1 addition & 0 deletions tuic-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ lexopt = { version = "0.3", default-features = false }
socket2 = { version = "0.5", default-features = false }
arc-swap = "1"
uuid = { version = "1", default-features = false, features = ["serde", "std", "v4"] }
chashmap = { package = "chashmap-async", version = "0.1" }

# QUIC
quinn = { version = "0.11", default-features = false, features = ["runtime-tokio", "rustls", "log"] }
Expand Down
2 changes: 2 additions & 0 deletions tuic-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ pub struct RestfulConfig {
pub addr: SocketAddr,
#[educe(Default = "YOUR_SECRET_HERE")]
pub secret: String,
#[educe(Default = 0)]
pub maximum_clients_per_user: u64,
}

impl Config {
Expand Down
4 changes: 2 additions & 2 deletions tuic-server/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl Connection {

match self.auth.get() {
Some(uuid) => {
restful::client_connect(&uuid);
restful::client_connect(&uuid, self.inner).await;
}
None => {
warn!(
Expand All @@ -167,7 +167,7 @@ impl Connection {

if self.is_closed() {
if let Some(uuid) = self.auth.get() {
restful::client_disconnect(&uuid);
restful::client_disconnect(&uuid, self.inner).await;
}
break;
}
Expand Down
Loading

0 comments on commit 2015dcf

Please sign in to comment.