main() — netty Function Reference
Architecture documentation for the main() function in DoTClient.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 1055fa45_0611_991b_2283_5b8e5df9faab["main()"] 5239d577_66b3_1cd2_3150_13fb7dba265f["DoTClient"] 1055fa45_0611_991b_2283_5b8e5df9faab -->|defined in| 5239d577_66b3_1cd2_3150_13fb7dba265f e3f30336_5d9e_1f18_3e77_758d6df5b165["handleQueryResp()"] 1055fa45_0611_991b_2283_5b8e5df9faab -->|calls| e3f30336_5d9e_1f18_3e77_758d6df5b165 style 1055fa45_0611_991b_2283_5b8e5df9faab fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/dns/dot/DoTClient.java lines 74–117
public static void main(String[] args) throws Exception {
EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
try {
final SslContext sslContext = SslContextBuilder.forClient()
.protocols("TLSv1.3", "TLSv1.2")
.build();
Bootstrap b = new Bootstrap();
b.group(group)
.channel(NioSocketChannel.class)
.handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) {
ChannelPipeline p = ch.pipeline();
p.addLast(sslContext.newHandler(ch.alloc(), DNS_SERVER_HOST, DNS_SERVER_PORT))
.addLast(new TcpDnsQueryEncoder())
.addLast(new TcpDnsResponseDecoder())
.addLast(new SimpleChannelInboundHandler<DefaultDnsResponse>() {
@Override
protected void channelRead0(ChannelHandlerContext ctx, DefaultDnsResponse msg) {
try {
handleQueryResp(msg);
} finally {
ctx.close();
}
}
});
}
});
final Channel ch = b.connect(DNS_SERVER_HOST, DNS_SERVER_PORT).sync().channel();
int randomID = new Random().nextInt(60000 - 1000) + 1000;
DnsQuery query = new DefaultDnsQuery(randomID, DnsOpCode.QUERY)
.setRecord(DnsSection.QUESTION, new DefaultDnsQuestion(QUERY_DOMAIN, DnsRecordType.A));
ch.writeAndFlush(query).sync();
boolean success = ch.closeFuture().await(10, TimeUnit.SECONDS);
if (!success) {
System.err.println("dns query timeout!");
ch.close().sync();
}
} finally {
group.shutdownGracefully();
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does main() do?
main() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/dns/dot/DoTClient.java.
Where is main() defined?
main() is defined in example/src/main/java/io/netty/example/dns/dot/DoTClient.java at line 74.
What does main() call?
main() calls 1 function(s): handleQueryResp.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free