all: add DNS Stamps support

See: https://dnscrypt.info/stamps-specifications
This commit is contained in:
Cuong Manh Le
2024-09-17 20:42:27 +07:00
committed by Cuong Manh Le
parent 08fe04f1ee
commit 282a8ce78e
7 changed files with 170 additions and 2 deletions
+15
View File
@@ -127,6 +127,21 @@ func TestConfigValidation(t *testing.T) {
}
}
func TestConfigValidationDoNotChangeEndpoint(t *testing.T) {
cfg := configWithInvalidDoHEndpoint(t)
endpointMap := map[string]struct{}{}
for _, uc := range cfg.Upstream {
endpointMap[uc.Endpoint] = struct{}{}
}
validate := validator.New()
_ = ctrld.ValidateConfig(validate, cfg)
for _, uc := range cfg.Upstream {
if _, ok := endpointMap[uc.Endpoint]; !ok {
t.Fatalf("expected endpoint '%s' to exist", uc.Endpoint)
}
}
}
func TestConfigDiscoverOverride(t *testing.T) {
v := viper.NewWithOptions(viper.KeyDelimiter("::"))
ctrld.InitConfig(v, "test_config_discover_override")