Support query param in upstream value

This commit is contained in:
Cuong Manh Le
2023-04-12 23:38:52 +07:00
committed by Cuong Manh Le
parent 8a2cdbfaa3
commit 2c7d95bba2
4 changed files with 154 additions and 117 deletions
+5
View File
@@ -110,6 +110,7 @@ type UpstreamConfig struct {
transport *http.Transport `mapstructure:"-" toml:"-"`
http3RoundTripper http.RoundTripper `mapstructure:"-" toml:"-"`
certPool *x509.CertPool `mapstructure:"-" toml:"-"`
u *url.URL `mapstructure:"-" toml:"-"`
g singleflight.Group
bootstrapIPs []string
@@ -142,6 +143,10 @@ type Rule map[string][]string
func (uc *UpstreamConfig) Init() {
if u, err := url.Parse(uc.Endpoint); err == nil {
uc.Domain = u.Host
switch uc.Type {
case ResolverTypeDOH, ResolverTypeDOH3:
uc.u = u
}
}
if uc.Domain != "" {
return