dns: Add timeout configuration
This commit is contained in:
@@ -48,6 +48,7 @@ func (o *DNSOptions) UnmarshalJSONContext(ctx context.Context, content []byte) e
|
||||
|
||||
type DNSClientOptions struct {
|
||||
Strategy DomainStrategy `json:"strategy,omitempty"`
|
||||
Timeout badoption.Duration `json:"timeout,omitempty"`
|
||||
DisableCache bool `json:"disable_cache,omitempty"`
|
||||
DisableExpire bool `json:"disable_expire,omitempty"`
|
||||
IndependentCache bool `json:"independent_cache,omitempty"`
|
||||
|
||||
@@ -94,6 +94,7 @@ type DialerOptions struct {
|
||||
|
||||
type _DomainResolveOptions struct {
|
||||
Server string `json:"server"`
|
||||
Timeout badoption.Duration `json:"timeout,omitempty"`
|
||||
Strategy DomainStrategy `json:"strategy,omitempty"`
|
||||
DisableCache bool `json:"disable_cache,omitempty"`
|
||||
DisableOptimisticCache bool `json:"disable_optimistic_cache,omitempty"`
|
||||
@@ -107,6 +108,7 @@ func (o DomainResolveOptions) MarshalJSON() ([]byte, error) {
|
||||
if o.Server == "" {
|
||||
return []byte("{}"), nil
|
||||
} else if o.Strategy == DomainStrategy(C.DomainStrategyAsIS) &&
|
||||
o.Timeout == 0 &&
|
||||
!o.DisableCache &&
|
||||
!o.DisableOptimisticCache &&
|
||||
o.RewriteTTL == nil &&
|
||||
|
||||
@@ -202,6 +202,7 @@ func (r *RouteOptionsActionOptions) UnmarshalJSON(data []byte) error {
|
||||
|
||||
type DNSRouteActionOptions struct {
|
||||
Server string `json:"server,omitempty"`
|
||||
Timeout badoption.Duration `json:"timeout,omitempty"`
|
||||
Strategy DomainStrategy `json:"strategy,omitempty"`
|
||||
DisableCache bool `json:"disable_cache,omitempty"`
|
||||
DisableOptimisticCache bool `json:"disable_optimistic_cache,omitempty"`
|
||||
@@ -211,6 +212,7 @@ type DNSRouteActionOptions struct {
|
||||
|
||||
type _DNSRouteOptionsActionOptions struct {
|
||||
Strategy DomainStrategy `json:"strategy,omitempty"`
|
||||
Timeout badoption.Duration `json:"timeout,omitempty"`
|
||||
DisableCache bool `json:"disable_cache,omitempty"`
|
||||
DisableOptimisticCache bool `json:"disable_optimistic_cache,omitempty"`
|
||||
RewriteTTL *uint32 `json:"rewrite_ttl,omitempty"`
|
||||
@@ -324,6 +326,7 @@ type RouteActionSniff struct {
|
||||
|
||||
type RouteActionResolve struct {
|
||||
Server string `json:"server,omitempty"`
|
||||
Timeout badoption.Duration `json:"timeout,omitempty"`
|
||||
Strategy DomainStrategy `json:"strategy,omitempty"`
|
||||
DisableCache bool `json:"disable_cache,omitempty"`
|
||||
DisableOptimisticCache bool `json:"disable_optimistic_cache,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user