summaryrefslogtreecommitdiff
path: root/server/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/main.rs')
-rw-r--r--server/src/main.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/server/src/main.rs b/server/src/main.rs
index 4db43c64..d0538126 100644
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -21,7 +21,7 @@ use futures_util::{SinkExt, StreamExt};
use hurrycurry_protocol::{PacketC, PacketS, BINCODE_CONFIG, VERSION};
use hurrycurry_server::{
data::DATA_DIR,
- register::Register,
+ network::{mdns::mdns_loop, register::Register, upnp::upnp_loop},
server::{GameServerExt, Server},
trm, ConnectionID,
};
@@ -59,9 +59,12 @@ pub(crate) struct Args {
/// Enables submissions to the public server registry
#[arg(long)]
register: bool,
- /// Enables mDNS discoverability
+ /// Enables the mDNS responder for local network discovery
#[arg(long)]
- discoverable: bool,
+ mdns: bool,
+ // Enables automatic gateway port forwarding using UPnP
+ #[arg(long)]
+ upnp: bool,
/// Server name
#[arg(long, short = 'N', default_value = "A Hurry Curry! Server")]
server_name: String,
@@ -130,6 +133,16 @@ async fn run(args: Args) -> anyhow::Result<()> {
);
tokio::task::spawn(r.register_loop());
}
+ if args.upnp {
+ tokio::task::spawn(upnp_loop(args.listen.port()));
+ }
+ if args.mdns {
+ tokio::task::spawn(mdns_loop(
+ args.server_name.clone(),
+ args.listen.port(),
+ state.clone(),
+ ));
+ }
{
let state = state.clone();