@UnstableApi
public final class DnsNameResolverBuilder
extends java.lang.Object
DnsNameResolver
建造者。
Constructor and Description |
---|
DnsNameResolverBuilder(EventLoop eventLoop)
创建一个新的构建器。
|
public DnsNameResolverBuilder channelFactory(ChannelFactory<? extends DatagramChannel> channelFactory)
ChannelFactory
,这将创建一个DatagramChannel
。
channelFactory
- ChannelFactory
this
public DnsNameResolverBuilder channelType(java.lang.Class<? extends DatagramChannel> channelType)
ChannelFactory
设置为此类型的ReflectiveChannelFactory
。
用作channelFactory(ChannelFactory)
的替代品 。
channelType
- 类型
this
public DnsNameResolverBuilder resolveCache(DnsCache resolveCache)
resolveCache
- DNS解析结果缓存
this
public DnsNameResolverBuilder dnsQueryLifecycleObserverFactory(DnsQueryLifecycleObserverFactory lifecycleObserverFactory)
lifecycleObserverFactory
- 用于生成可以观察单个DNS查询的对象的工厂。
this
public DnsNameResolverBuilder authoritativeDnsServerCache(DnsCache authoritativeDnsServerCache)
authoritativeDnsServerCache
- 权威NS服务器缓存
this
public DnsNameResolverBuilder ttl(int minTtl, int maxTtl)
0
和Integer.MAX_VALUE
,它实际上告诉解析器遵守DNS服务器的TTL。
minTtl
- 最小TTL
maxTtl
- 最大TTL
this
public DnsNameResolverBuilder negativeTtl(int negativeTtl)
negativeTtl
- 失败的缓存查询的TTL
this
public DnsNameResolverBuilder queryTimeoutMillis(long queryTimeoutMillis)
queryTimeoutMillis
- 查询超时
this
public static ResolvedAddressTypes computeResolvedAddressTypes(InternetProtocolFamily... internetProtocolFamilies)
ResolvedAddressTypes
一些InternetProtocolFamily
秒。
根据“java.net”系统属性,空输入将返回默认值。
有效输入是(),(IPv4),(IPv6),(Ipv4,IPv6)和(IPv6,IPv4)。
internetProtocolFamilies
-的有效序列InternetProtocolFamily
小号
ResolvedAddressTypes
public DnsNameResolverBuilder resolvedAddressTypes(ResolvedAddressTypes resolvedAddressTypes)
computeResolvedAddressTypes(InternetProtocolFamily...)
获得ResolvedAddressTypes
出来的一些InternetProtocolFamily
秒。
resolvedAddressTypes
- 地址类型
this
public DnsNameResolverBuilder recursionDesired(boolean recursionDesired)
recursionDesired
- 如果需要递归,则为true
this
public DnsNameResolverBuilder maxQueriesPerResolve(int maxQueriesPerResolve)
maxQueriesPerResolve
- 查询的最大数量
this
public DnsNameResolverBuilder traceEnabled(boolean traceEnabled)
traceEnabled
- 如果启用跟踪,则为true
this
public DnsNameResolverBuilder maxPayloadSize(int maxPayloadSize)
4096
字节。
maxPayloadSize
- 数据报数据包缓冲区的容量
this
public DnsNameResolverBuilder optResourceEnabled(boolean optResourceEnabled)
optResourceEnabled
- 如果可选记录包含已启用
this
public DnsNameResolverBuilder hostsFileEntriesResolver(HostsFileEntriesResolver hostsFileEntriesResolver)
hostsFileEntriesResolver
- HostsFileEntriesResolver
用于首先检查主机名是否是本地别名。
this
public DnsNameResolverBuilder nameServerProvider(DnsServerAddressStreamProvider dnsServerAddressStreamProvider)
DnsServerAddressStreamProvider
,用于确定哪个DNS服务器用于解析每个主机名。
this
。
public DnsNameResolverBuilder searchDomains(java.lang.Iterable<java.lang.String> searchDomains)
searchDomains
- 搜索域
this
public DnsNameResolverBuilder ndots(int ndots)
1
。
ndots
- ndots价值
this
public DnsNameResolverBuilder decodeIdn(boolean decodeIdn)
decodeIdn
- 如果应该解码
this
public DnsNameResolver build()
DnsNameResolver
实例。
DnsNameResolver
Copyright © 2008–2018 The Netty Project. All rights reserved.