Skip to content

Commit

Permalink
feat(dgw): initial implementation for /jet/fwd/http endpoint (#1084)
Browse files Browse the repository at this point in the history
Currently behind the unstable flag.
Some details may be adjusted in the future.

For HTTP requests without upgrade, we do not account the
operation as a session: it does not influence DVLS licensing
quota, subscriber events, etc. HTTP requests resulting into a
WebSocket upgrade however will count as a fully-fledged
session as usual.

Issue: DGW-217
Changelog: ignore
  • Loading branch information
CBenoit authored Nov 6, 2024
1 parent b5cfced commit 0143c4d
Show file tree
Hide file tree
Showing 15 changed files with 566 additions and 37 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

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

25 changes: 19 additions & 6 deletions crates/devolutions-gateway-generators/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,18 +234,31 @@ pub fn any_scope_claims(now: i64, validity_duration: i64) -> impl Strategy<Value
#[derive(Debug, Clone, Serialize)]
pub struct BridgeClaims {
pub target_host: TargetAddr,
pub jet_aid: Uuid,
pub jet_ap: ApplicationProtocol,
pub jet_rec: RecordingPolicy,
pub nbf: i64,
pub exp: i64,
pub jti: Uuid,
}

pub fn any_bridge_claims(now: i64, validity_duration: i64) -> impl Strategy<Value = BridgeClaims> {
(target_addr(), uuid_typed()).prop_map(move |(target_host, jti)| BridgeClaims {
target_host,
jti,
nbf: now,
exp: now + validity_duration,
})
(
target_addr(),
uuid_typed(),
application_protocol(),
recording_policy(),
uuid_typed(),
)
.prop_map(move |(target_host, jet_aid, jet_ap, jet_rec, jti)| BridgeClaims {
target_host,
jet_aid,
jet_ap,
jet_rec,
nbf: now,
exp: now + validity_duration,
jti,
})
}

#[derive(Debug, Clone, Serialize)]
Expand Down
4 changes: 3 additions & 1 deletion devolutions-gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ tracing = "0.1"
# Async, futures…
tokio = { version = "1.41", features = ["signal", "net", "io-util", "time", "rt", "rt-multi-thread", "sync", "macros", "parking_lot", "fs"] }
tokio-rustls = { version = "0.26", default-features = false, features = ["logging", "tls12", "ring"] }
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-native-roots", "json"] }
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-native-roots", "json", "stream"] }
futures = "0.3"
async-trait = "0.1"
tower = { version = "0.5", features = ["timeout"] }
Expand All @@ -78,6 +78,8 @@ axum = { version = "0.7", default-features = false, features = ["http1", "json",
axum-extra = { version = "0.9", features = ["query", "async-read-body", "typed-header"] }
tower-http = { version = "0.5", features = ["cors", "fs"] }
tungstenite = "0.24" # Should be the same version as `axum` (we perform error downcasting for better error reporting)
tokio-tungstenite = { version = "0.24", features = ["rustls-tls-native-roots"] } # Should use the same version of tungstenite as `axum`
http-body-util = "0.1"

# OpenAPI generator
utoipa = { version = "4.2", default-features = false, features = ["uuid", "time"], optional = true }
Expand Down
Loading

0 comments on commit 0143c4d

Please sign in to comment.