Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

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

8 changes: 5 additions & 3 deletions engine/packages/guard-core/src/custom_serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ use bytes::Bytes;
use http_body_util::Full;
use hyper::{Request, Response};
use tokio_tungstenite::tungstenite::protocol::frame::CloseFrame;
use uuid::Uuid;

use crate::WebSocketHandle;
use crate::proxy_service::ResponseBody;
use crate::request_context::RequestContext;

use pegboard::tunnel::id::RequestId;

pub enum HibernationResult {
Continue,
Close,
Expand All @@ -23,6 +24,7 @@ pub trait CustomServeTrait: Send + Sync {
&self,
req: Request<Full<Bytes>>,
request_context: &mut RequestContext,
request_id: RequestId,
) -> Result<Response<ResponseBody>>;

/// Handle a WebSocket connection after upgrade. Supports connection retries.
Expand All @@ -33,7 +35,7 @@ pub trait CustomServeTrait: Send + Sync {
_path: &str,
_request_context: &mut RequestContext,
// Identifies the websocket across retries.
_unique_request_id: Uuid,
_unique_request_id: RequestId,
// True if this websocket is reconnecting after hibernation.
_after_hibernation: bool,
) -> Result<Option<CloseFrame>> {
Expand All @@ -44,7 +46,7 @@ pub trait CustomServeTrait: Send + Sync {
async fn handle_websocket_hibernation(
&self,
_websocket: WebSocketHandle,
_unique_request_id: Uuid,
_unique_request_id: RequestId,
) -> Result<HibernationResult> {
bail!("service does not support websocket hibernation");
}
Expand Down
1 change: 1 addition & 0 deletions engine/packages/guard-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub mod websocket_handle;

pub use cert_resolver::CertResolverFn;
pub use custom_serve::CustomServeTrait;
pub use pegboard::tunnel::id::{RequestId, generate_request_id};
pub use proxy_service::{
CacheKeyFn, MiddlewareFn, ProxyService, ProxyState, RouteTarget, RoutingFn, RoutingOutput,
};
Expand Down
Loading
Loading