use of io.netty.handler.codec.dns.DefaultDnsOptEcsRecord in project netty by netty.
the class DnsNameResolverClientSubnetTest method testSubnetQuery.
// See https://www.gsic.uva.es/~jnisigl/dig-edns-client-subnet.html
// Ignore as this needs to query real DNS servers.
@Disabled
@Test
public void testSubnetQuery() throws Exception {
EventLoopGroup group = new NioEventLoopGroup(1);
DnsNameResolver resolver = newResolver(group).build();
try {
// Same as:
// # /.bind-9.9.3-edns/bin/dig @ns1.google.com www.google.es +client=157.88.0.0/24
Future<List<InetAddress>> future = resolver.resolveAll("www.google.es", Collections.<DnsRecord>singleton(// 157.88.0.0 / 24
new DefaultDnsOptEcsRecord(1024, 24, SocketUtils.addressByName("157.88.0.0").getAddress())));
for (InetAddress address : future.syncUninterruptibly().getNow()) {
System.out.println(address);
}
} finally {
resolver.close();
group.shutdownGracefully(0, 0, TimeUnit.SECONDS);
}
}
Aggregations