Add dynamic access key #7

Merged
redbinder0526 merged 4 commits from v0 into v0 2026-04-25 23:07:52 +02:00
5 changed files with 10 additions and 3 deletions
Showing only changes of commit 6d13907588 - Show all commits

Dynamically define access key

red binder 2026-04-12 22:15:15 +02:00

View file

@ -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"

View file

@ -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}")]

View file

@ -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<Md5>;

View file

@ -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");

View file

@ -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");