Skip to content

Commit

Permalink
Dockerfile: Mux the ports by default #286 [ds only]
Browse files Browse the repository at this point in the history
  • Loading branch information
geneotech committed Jun 18, 2024
1 parent da80bea commit cd9655d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ COPY cmake/dockerfile_server_config.lua /root/.config/Hypersomnia/user/config.fo

CMD ["./Hypersomnia-Headless.AppImage", "--appimage-extract-and-run"]

# For native clients via POSIX sockets
EXPOSE 8412/udp
EXPOSE 9000-9010/udp

# For Web clients via WebRTC
EXPOSE 9000/udp

3 changes: 3 additions & 0 deletions cmake/dockerfile_server_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ return {
last_activity = "MAIN_MENU",
server = {
server_name = "Server"

webrtc_udp_mux = true,
webrtc_port_range_begin = 9000
},
server_private = {
master_rcon_password = "1234",
Expand Down
2 changes: 1 addition & 1 deletion hypersomnia/default_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ treat_as_music_sounds_longer_than_secs = 5,
allow_webrtc_clients = true,

-- If true, connections will use only single UDP port.
-- In that case set webrtc_port_range_begin and webrtc_port_range_end to the same value.
-- In that case, the chosen port will be set to webrtc_port_range_begin.
webrtc_udp_mux = false,

webrtc_port_range_begin = 9000,
Expand Down
14 changes: 11 additions & 3 deletions src/application/setups/server/server_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,19 @@ class webrtc_server_detail {
const std::string& signaling_server_url,
const std::vector<rtc::IceServer>& iceServers,
const port_type ports_begin,
const port_type ports_end,
port_type ports_end,
const bool udp_mux
) {
LOG("Web port range: %x-%x", ports_begin, ports_end);
LOG("Web UDP port mux: %x", udp_mux);
LOG("Web UDP port muxing: %x", udp_mux);

if (udp_mux) {
ports_end = ports_begin;
LOG("Web port range: %x (UDP muxing was enabled)", ports_begin);
}
else {
LOG("Web port range: %x-%x", ports_begin, ports_end);
}

self->config.iceServers = iceServers;
#if PLATFORM_WEB
(void)ports_begin;
Expand Down

0 comments on commit cd9655d

Please sign in to comment.