From 6d139075886665b270442bec7dc070bbeca9e660 Mon Sep 17 00:00:00 2001 From: red binder Date: Sun, 12 Apr 2026 22:15:15 +0200 Subject: [PATCH] Dynamically define access key --- editions.yaml | 2 ++ proxy-common/src/lib.rs | 5 +++++ prudpv0/src/crypto/friends_common.rs | 2 +- prudpv1/src/executables/proxy_insecure.rs | 2 +- prudpv1/src/executables/proxy_secure.rs | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/editions.yaml b/editions.yaml index 5458ec6..7a6869c 100644 --- a/editions.yaml +++ b/editions.yaml @@ -7,6 +7,7 @@ splatoon: RNEX_VIRTUAL_PORT_INSECURE: "1:10" RNEX_VIRTUAL_PORT_SECURE: "1:10" RNEX_DEFAULT_PORT: 6000 + RNEX_ACCESS_KEY: "6f599f81" splatoon2: features: - v4-3-11 @@ -25,3 +26,4 @@ friends: RNEX_VIRTUAL_PORT_INSECURE: "1:10" RNEX_VIRTUAL_PORT_SECURE: "1:10" RNEX_DEFAULT_PORT: 6000 + RNEX_ACCESS_KEY: "ridfebb9" diff --git a/proxy-common/src/lib.rs b/proxy-common/src/lib.rs index dc6ed11..9c18f2e 100644 --- a/proxy-common/src/lib.rs +++ b/proxy-common/src/lib.rs @@ -31,6 +31,11 @@ const RNEX_DEFAULT_PORT: u16 = match u16::from_str_radix(env!("RNEX_DEFAULT_PORT Err(_) => panic!("unable to get default port from env"), }; +const RNEX_ACCESS_KEY: u16 = match u16::from_str_radix(env!("RNEX_ACCESS_KEY"), 10) { + Ok(v) => v, + Err(_) => panic!("unable to get access key from env"), +}; + #[derive(Error, Debug)] pub enum Error { #[error("error getting environment variable \"{0}\": {1}")] diff --git a/prudpv0/src/crypto/friends_common.rs b/prudpv0/src/crypto/friends_common.rs index b11af1d..6ae6e42 100644 --- a/prudpv0/src/crypto/friends_common.rs +++ b/prudpv0/src/crypto/friends_common.rs @@ -1,5 +1,5 @@ use hmac::Hmac; use md5::Md5; -pub const ACCESS_KEY: &str = "ridfebb9"; +pub const ACCESS_KEY: &str = RNEX_ACCESS_KEY; pub type HmacMd5 = Hmac; diff --git a/prudpv1/src/executables/proxy_insecure.rs b/prudpv1/src/executables/proxy_insecure.rs index 975f837..4049566 100644 --- a/prudpv1/src/executables/proxy_insecure.rs +++ b/prudpv1/src/executables/proxy_insecure.rs @@ -43,7 +43,7 @@ pub async fn start() { .expect("unable to start router"); let mut socket_secure = router_secure - .add_socket(VirtualPort::new(1, 10), Unsecure("6f599f81")) + .add_socket(VirtualPort::new(1, 10), Unsecure(RNEX_ACCESS_KEY)) .await .expect("unable to add socket"); diff --git a/prudpv1/src/executables/proxy_secure.rs b/prudpv1/src/executables/proxy_secure.rs index 8446391..a16360e 100644 --- a/prudpv1/src/executables/proxy_secure.rs +++ b/prudpv1/src/executables/proxy_secure.rs @@ -30,7 +30,7 @@ pub async fn start() { let mut socket_secure = router_secure .add_socket( VirtualPort::new(1, 10), - Secure("6f599f81", SECURE_SERVER_ACCOUNT.clone()), + Secure(RNEX_ACCESS_KEY, SECURE_SERVER_ACCOUNT.clone()), ) .await .expect("unable to add socket");