mirror of https://github.com/status-im/consul.git
Adding singleton option to DNS for getaddrinfo bug.
This commit is contained in:
parent
cff05be5b4
commit
74623c372a
|
@ -77,6 +77,14 @@ type DNSConfig struct {
|
||||||
// returned by default for UDP.
|
// returned by default for UDP.
|
||||||
EnableTruncate bool `mapstructure:"enable_truncate"`
|
EnableTruncate bool `mapstructure:"enable_truncate"`
|
||||||
|
|
||||||
|
// EnableSingleton is used to override default behavior
|
||||||
|
// of DNS and return only a single host in a round robin
|
||||||
|
// DNS service request rather than all healthy service
|
||||||
|
// members. This is a work around for systems using
|
||||||
|
// getaddrinfo using rule 9 sorting from RFC3484 which
|
||||||
|
// breaks round robin DNS.
|
||||||
|
EnableSingleton bool `mapstructure:"enable_singleton"`
|
||||||
|
|
||||||
// MaxStale is used to bound how stale of a result is
|
// MaxStale is used to bound how stale of a result is
|
||||||
// accepted for a DNS lookup. This can be used with
|
// accepted for a DNS lookup. This can be used with
|
||||||
// AllowStale to limit how old of a value is served up.
|
// AllowStale to limit how old of a value is served up.
|
||||||
|
@ -1130,6 +1138,9 @@ func MergeConfig(a, b *Config) *Config {
|
||||||
if b.DNSConfig.EnableTruncate {
|
if b.DNSConfig.EnableTruncate {
|
||||||
result.DNSConfig.EnableTruncate = true
|
result.DNSConfig.EnableTruncate = true
|
||||||
}
|
}
|
||||||
|
if b.DNSConfig.EnableSingleton {
|
||||||
|
result.DNSConfig.EnableSingleton = true
|
||||||
|
}
|
||||||
if b.DNSConfig.MaxStale != 0 {
|
if b.DNSConfig.MaxStale != 0 {
|
||||||
result.DNSConfig.MaxStale = b.DNSConfig.MaxStale
|
result.DNSConfig.MaxStale = b.DNSConfig.MaxStale
|
||||||
}
|
}
|
||||||
|
|
|
@ -702,6 +702,9 @@ func (d *DNSServer) serviceNodeRecords(dc string, nodes structs.CheckServiceNode
|
||||||
if records != nil {
|
if records != nil {
|
||||||
resp.Answer = append(resp.Answer, records...)
|
resp.Answer = append(resp.Answer, records...)
|
||||||
}
|
}
|
||||||
|
if d.config.EnableSingleton {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue