(t *testing.T)
| 52 | } |
| 53 | |
| 54 | func 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 | |
| 80 | func TestNewWireGuardConfigLatencyNested(t *testing.T) { |
| 81 | configJSON := `{ |
nothing calls this directly
no test coverage detected