feat: add exact-room peer ICE TURN fallback (#66)

This commit is contained in:
AAA authored and GitHub committed 2026-08-20 13:37:02 +08:00
1 parent 078da7bb57
commit 1e11e09261
34 files changed
+1492 -207

No files matched your search

+20 -2
View File
@@ -51,6 +51,24 @@ func TestMarshalHostSignalShapes(t *testing.T) {
}
}
func TestMarshalNativeAuthenticationDoesNotOptIntoWebPeerICETURN(t *testing.T) {
encoded, err := json.Marshal(authenticateMessage{
Type: "authenticate",
Protocol: signalingProtocol,
RoomID: "1",
Role: "host",
Token: strings.Repeat("a", 32),
ClientID: "native-client",
ShareGeneration: "native-generation",
})
if err != nil {
t.Fatal(err)
}
if strings.Contains(string(encoded), "capabilities") || strings.Contains(string(encoded), "peerIceTurn") {
t.Fatalf("native authentication opted into Web-only Peer ICE TURN: %s", encoded)
}
}
func TestDecodeOrdinaryHostAuthentication(t *testing.T) {
message, err := decodeServerMessage([]byte(validHostAuthenticated))
if err != nil {
@@ -100,10 +118,10 @@ func TestDecodeOrdinaryHostAuthenticationRejectsInvalidVariants(t *testing.T) {
}
}
func TestDecodeServerMessageRejectsRemovedICERefresh(t *testing.T) {
func TestDecodeServerMessageRejectsWebOnlyICERefresh(t *testing.T) {
payload := []byte(`{"type":"ice-config","iceConfig":{"iceServers":[]}}`)
if _, err := decodeServerMessage(payload); err == nil {
t.Fatal("removed ICE refresh message was accepted")
t.Fatal("Web-only ICE refresh message was accepted")
}
}