-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Commented out all modules/function which require futures/tokio upgrade; Updated Cargo.toml * async-upgrade: Updated utils.rs; Implemented async dns resolution function * Performed refactoring on JetSink/JetStream * Upgraded tcp transport logic to tokio 0.3 * Upgraded WebSockets transport module * Finished JetTransport upgrade * Managed to completely port transport module * Upgraded proxy module to the newest tokio/futures * Draft sequence feature futures 0.3 port * Performed refactoring on sequence future * Ported negotiation sequence future * Upgraded dvc_capabilities, finalization, mcs and post_mcst sequence futures * Upgraded nla sequence future * Upgraded connection sequence future * Upgraded accept_connection future * Upgraded rdp.rs * Upgraded http middleware, health controller and session controller * Upgraded utils::association, http::controllers::jet * Upgraded http module * cargo fmt * routing client upgrade * Upgraded jet_client.rs to use async/await * update websocket_client to the newest futures * minor warnings fixes * Fixed buildability * async upgrade on start_websocket_server * finished upgrade of service * General refactoring * Updated rustls repo * async update on main * build fixes * fix tests releated bugs * refactoring * Updated Cargo.lock * Fixed jet transport sink * Fixed jet sink * runnning gateway with a few rdp clients parallelly bugfix * Fixed issue with ws forwarding * Fixed AsyncWrite trait implimentation for WsStream;Fixed missing WebSocket client request processing via Saphir * Implemented graceful shutdown for http server * Added jetsocat to ci script, added env-dependent integration tests to ignore * Fixed WebSockets Jet client deadlock * Fixed typos, removed commented code * Applied cargo fmt:
- Loading branch information
1 parent
d9f4bb1
commit 27b0821
Showing
41 changed files
with
3,324 additions
and
2,616 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,31 @@ | ||
use crate::config::Config; | ||
use saphir::{Method, *}; | ||
use saphir::{ | ||
controller::Controller, | ||
http::{Method, StatusCode}, | ||
macros::controller, | ||
}; | ||
use std::sync::Arc; | ||
|
||
struct ControllerData { | ||
config: Arc<Config>, | ||
} | ||
|
||
pub struct HealthController { | ||
dispatch: ControllerDispatch<ControllerData>, | ||
config: Arc<Config>, | ||
} | ||
|
||
impl HealthController { | ||
pub fn new(config: Arc<Config>) -> Self { | ||
let dispatch = ControllerDispatch::new(ControllerData { config }); | ||
dispatch.add(Method::GET, "/", health); | ||
|
||
HealthController { dispatch } | ||
Self { config } | ||
} | ||
} | ||
|
||
impl Controller for HealthController { | ||
fn handle(&self, req: &mut SyncRequest, res: &mut SyncResponse) { | ||
self.dispatch.dispatch(req, res); | ||
} | ||
|
||
fn base_path(&self) -> &str { | ||
"/health" | ||
#[controller(name = "health")] | ||
impl HealthController { | ||
#[get("/")] | ||
async fn get_health(&self) -> (u16, String) { | ||
build_health_response(&self.config) | ||
} | ||
} | ||
|
||
fn health(controller: &ControllerData, _req: &SyncRequest, res: &mut SyncResponse) { | ||
build_health_response(res, &controller.config.hostname); | ||
} | ||
|
||
pub fn build_health_response(res: &mut SyncResponse, hostname: &str) { | ||
res.status(StatusCode::OK) | ||
.body(format!("Devolutions Gateway \"{}\" is alive and healthy.", hostname)); | ||
pub fn build_health_response(config: &Config) -> (u16, String) { | ||
let hostname = &config.hostname; | ||
let response_body = format!("Devolutions Gateway \"{}\" is alive and healthy.", hostname); | ||
(StatusCode::OK.as_u16(), response_body) | ||
} |
Oops, something went wrong.