mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-04 09:07:29 +08:00
feat: add turn-ready node p2p config
This commit is contained in:
@@ -151,3 +151,29 @@ func TestValidateRejectsUnknownGatewayNodeP2PTransport(t *testing.T) {
|
||||
t.Fatalf("expected validation errors")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateGatewayNodeP2PIceServersAllowsStunOnly(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cfg := DefaultConfig()
|
||||
cfg.Gateway.Nodes.P2P.ICEServers = []GatewayICEConfig{
|
||||
{URLs: []string{"stun:stun.l.google.com:19302"}},
|
||||
}
|
||||
|
||||
if errs := Validate(cfg); len(errs) != 0 {
|
||||
t.Fatalf("expected config to be valid, got %v", errs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateGatewayNodeP2PIceServersRequireTurnCredentials(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
cfg := DefaultConfig()
|
||||
cfg.Gateway.Nodes.P2P.ICEServers = []GatewayICEConfig{
|
||||
{URLs: []string{"turn:turn.example.com:3478?transport=udp"}},
|
||||
}
|
||||
|
||||
if errs := Validate(cfg); len(errs) == 0 {
|
||||
t.Fatalf("expected validation errors")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user