diff options
| author | metamuffin <metamuffin@disroot.org> | 2025-10-17 23:12:26 +0200 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2025-10-17 23:12:26 +0200 |
| commit | cdfb82a9a27935986400dc90bee16eb896b0c004 (patch) | |
| tree | 172b02d26678423a7ec810a047b9c4245fbe3bef /server/src/network | |
| parent | 32c4c7801ca14e687b32d2b2254ec762df146d5d (diff) | |
| download | hurrycurry-cdfb82a9a27935986400dc90bee16eb896b0c004.tar hurrycurry-cdfb82a9a27935986400dc90bee16eb896b0c004.tar.bz2 hurrycurry-cdfb82a9a27935986400dc90bee16eb896b0c004.tar.zst | |
Add CLI option for user defined registry address (close #481)
Diffstat (limited to 'server/src/network')
| -rw-r--r-- | server/src/network/register.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/server/src/network/register.rs b/server/src/network/register.rs index b14c10b7..060994fe 100644 --- a/server/src/network/register.rs +++ b/server/src/network/register.rs @@ -29,12 +29,11 @@ use std::{ }; use tokio::{sync::RwLock, time::interval}; -const REGISTRY_URI: &str = "https://hurrycurry-registry.metamuffin.org"; - pub struct Register { name: String, port: u16, register_uri: Option<String>, + registry_uri: String, state: Arc<RwLock<Server>>, ip4_client: Option<Client>, ip6_client: Option<Client>, @@ -47,6 +46,7 @@ impl Register { name: String, port: u16, register_uri: Option<String>, + registry_uri: String, state: Arc<RwLock<Server>>, no4: bool, no6: bool, @@ -54,6 +54,7 @@ impl Register { Self { name, register_uri, + registry_uri, players: 0, port, secret: random(..), @@ -124,7 +125,7 @@ impl Register { // TODO ip v6 pub async fn register_with(&self, client: &Client, uri: String) -> Result<()> { let res = client - .post(Url::from_str(&format!("{REGISTRY_URI}/v1/register")).unwrap()) + .post(Url::from_str(&format!("{}/v1/register", self.registry_uri)).unwrap()) .header( USER_AGENT, format!("hurrycurry-server {}", env!("CARGO_PKG_VERSION")), |