feat(network): add selectable privacy-preserving discovery

This commit is contained in:
Alexander Sellite 2026-09-01 10:21:26 -04:00
parent 9cf0c8fc9c
commit 4d31fd1517
26 changed files with 959 additions and 153 deletions

View file

@ -25,7 +25,7 @@ signal return_to_title_requested
signal reset_progress_requested
signal quit_requested
signal menu_visibility_changed(is_open: bool)
signal join_game_requested(endpoint: String)
signal join_game_requested(route: ConnectionRoute)
enum ConfirmationAction {
NONE,
@ -240,18 +240,29 @@ func _close_join_game() -> void:
_begin_root_entry(true)
func _on_join_confirmation_requested(_endpoint: String) -> void:
func _on_join_confirmation_requested(
_endpoint: String,
relayed: bool,
) -> void:
if _action_in_progress or _root_transition_active:
_join_game_page.cancel_pending_join_confirmation()
return
_confirmation_action = ConfirmationAction.JOIN_ANOTHER
_confirmation_returns_to_join_game = true
var privacy_message := (
"this join uses a privacy relay. the other player sees the relay "
+ "address instead of your residential IP; the relay service still "
+ "handles both addresses and will not silently fall back to direct."
if relayed
else "this is a direct peer-to-peer connection, not a relay. the "
+ "remote host can see your public IP address. discovery room "
+ "addresses are not displayed or saved."
)
_confirmation_page.configure(
(
"join another game?\n\n"
+ "your progression will be saved first. current players will be "
+ "disconnected if you are hosting."
),
"join another game?\n\n"
+ "your progression will be saved first. current players will be "
+ "disconnected if you are hosting.\n\n"
+ privacy_message,
"save and join",
"cancel",
BubbleConfirmationPageType.InitialFocus.CONFIRM,
@ -261,8 +272,8 @@ func _on_join_confirmation_requested(_endpoint: String) -> void:
_show_confirmation()
func _on_confirmed_join_requested(endpoint: String) -> void:
join_game_requested.emit(endpoint)
func _on_confirmed_join_requested(route: ConnectionRoute) -> void:
join_game_requested.emit(route)
func report_network_error(message: String) -> void: