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

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,8 @@ const RNEX_DEFAULT_PORT: u16 = match u16::from_str_radix(env!("RNEX_DEFAULT_PORT
Err(_) => panic!("unable to get default port from env"),
};
pub const RNEX_ACCESS_KEY: &'static str = env!("RNEX_ACCESS_KEY");
#[derive(Error, Debug)]
pub enum Error {
#[error("error getting environment variable \"{0}\": {1}")]

View file

@ -1,5 +1,6 @@
use hmac::Hmac;
use md5::Md5;
use proxy_common::RNEX_ACCESS_KEY;
pub const ACCESS_KEY: &str = "ridfebb9";
pub const ACCESS_KEY: &str = RNEX_ACCESS_KEY;
pub type HmacMd5 = Hmac<Md5>;

View file

@ -19,6 +19,7 @@ use std::time::Duration;
use tokio::net::TcpStream;
use tokio::task;
use tokio::time::sleep;
use proxy_common::RNEX_ACCESS_KEY;
pub async fn start() {
/*let conn = tokio::net::TcpStream::connect(&*EDGE_NODE_HOLDER)
@ -43,7 +44,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

@ -21,6 +21,7 @@ use std::time::Duration;
use tokio::net::TcpStream;
use tokio::task;
use tokio::time::sleep;
use proxy_common::RNEX_ACCESS_KEY;
pub async fn start() {
let (router_secure, _) = Router::new(SocketAddrV4::new(*OWN_IP_PRIVATE, *SERVER_PORT))
@ -30,7 +31,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");