Skip to content

Commit 30b52ba

Browse files
committed
chore(guard): clean up guard
1 parent 93864b6 commit 30b52ba

File tree

20 files changed

+1237
-1551
lines changed

20 files changed

+1237
-1551
lines changed

engine/packages/guard-core/src/analytics.rs

Lines changed: 0 additions & 46 deletions
This file was deleted.

engine/packages/guard-core/src/custom_serve.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ use async_trait::async_trait;
33
use bytes::Bytes;
44
use http_body_util::Full;
55
use hyper::{Request, Response};
6-
use rivet_runner_protocol as protocol;
7-
use rivet_util::Id;
86
use tokio_tungstenite::tungstenite::protocol::frame::CloseFrame;
97

108
use crate::WebSocketHandle;
11-
use crate::proxy_service::ResponseBody;
9+
use crate::request_context::RequestContext;
10+
use crate::response_body::ResponseBody;
1211

1312
pub enum HibernationResult {
1413
Continue,
@@ -22,21 +21,14 @@ pub trait CustomServeTrait: Send + Sync {
2221
async fn handle_request(
2322
&self,
2423
req: Request<Full<Bytes>>,
25-
ray_id: Id,
26-
req_id: Id,
27-
request_id: protocol::RequestId,
24+
req_ctx: &mut RequestContext,
2825
) -> Result<Response<ResponseBody>>;
2926

3027
/// Handle a WebSocket connection after upgrade. Supports connection retries.
3128
async fn handle_websocket(
3229
&self,
30+
_req_ctx: &mut RequestContext,
3331
_websocket: WebSocketHandle,
34-
_headers: &hyper::HeaderMap,
35-
_path: &str,
36-
_ray_id: Id,
37-
_req_id: Id,
38-
// Identifies the websocket across retries.
39-
_request_id: protocol::RequestId,
4032
// True if this websocket is reconnecting after hibernation.
4133
_after_hibernation: bool,
4234
) -> Result<Option<CloseFrame>> {
@@ -46,10 +38,8 @@ pub trait CustomServeTrait: Send + Sync {
4638
/// Returns true if the websocket should close.
4739
async fn handle_websocket_hibernation(
4840
&self,
41+
_req_ctx: &mut RequestContext,
4942
_websocket: WebSocketHandle,
50-
_ray_id: Id,
51-
_req_id: Id,
52-
_request_id: protocol::RequestId,
5343
) -> Result<HibernationResult> {
5444
bail!("service does not support websocket hibernation");
5545
}

engine/packages/guard-core/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
pub mod analytics;
21
pub mod cert_resolver;
32
pub mod custom_serve;
43
pub mod errors;
54
pub mod metrics;
65
pub mod proxy_service;
6+
pub mod request_context;
7+
mod response_body;
8+
mod route;
79
mod server;
810
mod task_group;
911
pub mod types;
12+
pub mod utils;
1013
pub mod websocket_handle;
1114

1215
pub use cert_resolver::CertResolverFn;
1316
pub use custom_serve::CustomServeTrait;
14-
pub use proxy_service::{
15-
CacheKeyFn, MiddlewareFn, ProxyService, ProxyState, RouteTarget, RoutingFn, RoutingOutput,
16-
};
17+
pub use proxy_service::{ProxyService, ProxyState};
18+
pub use response_body::ResponseBody;
19+
pub use route::{CacheKeyFn, RouteConfig, RouteTarget, RoutingFn, RoutingOutput};
1720
pub use websocket_handle::WebSocketHandle;
1821

1922
// Re-export hyper StatusCode for use in other crates

0 commit comments

Comments
 (0)