feat: add selectable allocation-based privacy relay

This commit is contained in:
Alexander Sellite 2026-09-01 10:21:34 -04:00
parent e979da9e76
commit 46de16db00
14 changed files with 1067 additions and 43 deletions

View file

@ -22,6 +22,7 @@ class ServerConfigCompatibilityTests(unittest.TestCase):
self.assertEqual(config.bind_host, "127.0.0.9")
self.assertEqual(config.bind_port, 7791)
self.assertEqual(config.build_revision, "legacy-config")
self.assertTrue(config.relay_enabled)
def test_straywild_environment_wins_over_legacy_names(self) -> None:
with patch.dict(
@ -38,6 +39,15 @@ class ServerConfigCompatibilityTests(unittest.TestCase):
self.assertEqual(config.bind_host, "127.0.0.8")
self.assertEqual(config.bind_port, 7792)
def test_relay_can_be_explicitly_disabled_without_fallback_ambiguity(self) -> None:
with patch.dict(
os.environ,
{"straywild_DISCOVERY_RELAY_ENABLED": "false"},
clear=True,
):
config = ServerConfig.from_environment()
self.assertFalse(config.relay_enabled)
if __name__ == "__main__":
unittest.main()