MCPcopy Create free account
hub / github.com/PasarGuard/node / TestNewWireGuardConfigDefaults

Function TestNewWireGuardConfigDefaults

backend/wireguard/config_test.go:54–78  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

52}
53
54func TestNewWireGuardConfigDefaults(t *testing.T) {
55 configJSON := `{}`
56
57 config, err := NewConfig(configJSON)
58 if err != nil {
59 t.Fatalf("NewConfig failed: %v", err)
60 }
61
62 if config.InterfaceName != "wg0" {
63 t.Errorf("Expected default interface_name 'wg0', got: %s", config.InterfaceName)
64 }
65
66 if config.ListenPort != 51820 {
67 t.Errorf("Expected default listen_port 51820, got: %d", config.ListenPort)
68 }
69 if config.Latency == nil {
70 t.Fatal("expected default latency config")
71 }
72 if config.Latency.TestURL != "https://www.gstatic.com/generate_204" {
73 t.Errorf("expected default latency.test_url, got: %s", config.Latency.TestURL)
74 }
75 if config.Latency.TimeoutSeconds != 5 {
76 t.Errorf("expected default latency.timeout_seconds 5, got: %d", config.Latency.TimeoutSeconds)
77 }
78}
79
80func TestNewWireGuardConfigLatencyNested(t *testing.T) {
81 configJSON := `{

Callers

nothing calls this directly

Calls 1

NewConfigFunction · 0.70

Tested by

no test coverage detected