Skip to content

Commit ba7a88d

Browse files
committed
fix(guard): allow routing to path-based endpoints via any hostname for dev clusters (#2469)
<!-- Please make sure there is an issue that this PR is correlated to. --> ## Changes <!-- If there are frontend changes, please include screenshots. -->
1 parent a050f1e commit ba7a88d

File tree

5 files changed

+39
-163
lines changed

5 files changed

+39
-163
lines changed

Cargo.lock

Lines changed: 27 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ rev = "8a313913fa73d58f4f9532565b0084e723bc34ad"
8282

8383
[workspace.dependencies.deno_runtime]
8484
git = "https://github.com/rivet-gg/deno"
85-
rev = "512c62fabf104be9c23dc585dff739cba8e424b3"
85+
rev = "a6903d67063e07b82836399f63c7a0fa5be8bf56"
8686

8787
[workspace.dependencies.api-helper]
8888
path = "packages/common/api-helper/build"

packages/edge/infra/guard/core/src/util.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,6 @@ use uuid::Uuid;
44

55
use crate::types::{EndpointType, GameGuardProtocol};
66

7-
/// Build a hostname and path regex for the given endpoint type
8-
///
9-
/// Returns a tuple of (hostname_regex, path_regex) where path_regex is None for Hostname type
10-
pub fn build_actor_hostname_and_path_regex(
11-
endpoint_type: EndpointType,
12-
guard_hostname: &str,
13-
) -> GlobalResult<Option<(Regex, Option<Regex>)>> {
14-
if guard_hostname.is_empty() {
15-
return Ok(None);
16-
}
17-
18-
match endpoint_type {
19-
EndpointType::Hostname => {
20-
// Format: {actor_id}-{port_name}.{guard_hostname}
21-
let hostname_pattern = format!(
22-
r"^(?P<actor_id>[0-9a-f]{{8}}-[0-9a-f]{{4}}-[0-9a-f]{{4}}-[0-9a-f]{{4}}-[0-9a-f]{{12}})-(?P<port_name>[a-zA-Z0-9_-]+)\.{}$",
23-
regex::escape(guard_hostname)
24-
);
25-
let hostname_regex = Regex::new(&hostname_pattern)?;
26-
Ok(Some((hostname_regex, None)))
27-
}
28-
EndpointType::Path => {
29-
// Hostname is just the guard hostname
30-
let hostname_pattern = format!("^{}$", regex::escape(guard_hostname));
31-
let hostname_regex = Regex::new(&hostname_pattern)?;
32-
33-
// Path format: /{actor_id}-{port_name}(/.*)?
34-
let path_pattern = r"^/(?P<actor_id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-(?P<port_name>[a-zA-Z0-9_-]+)(/.*)?$";
35-
let path_regex = Regex::new(path_pattern)?;
36-
37-
Ok(Some((hostname_regex, Some(path_regex))))
38-
}
39-
}
40-
}
41-
427
/// Build a hostname or path string for the given endpoint type
438
pub fn build_actor_hostname_and_path(
449
endpoint_type: EndpointType,

packages/edge/infra/guard/core/tests/actor_routing_regex.rs

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

0 commit comments

Comments
 (0)