1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.resolver.dns.macos;
17
18 import io.netty.channel.unix.NativeInetAddress;
19
20 import java.net.InetSocketAddress;
21
22
23
24
25 final class DnsResolver {
26
27 private final String domain;
28 private final InetSocketAddress[] nameservers;
29 private final int port;
30 private final String[] searches;
31 private final String options;
32 private final int timeout;
33 private final int searchOrder;
34
35 DnsResolver(String domain, byte[][] nameservers, int port,
36 String[] searches, String options, int timeout, int searchOrder) {
37 this.domain = domain;
38 if (nameservers == null) {
39 this.nameservers = new InetSocketAddress[0];
40 } else {
41 this.nameservers = new InetSocketAddress[nameservers.length];
42 for (int i = 0; i < nameservers.length; i++) {
43 byte[] addr = nameservers[i];
44 this.nameservers[i] = NativeInetAddress.address(addr, 0, addr.length);
45 }
46 }
47 this.port = port;
48 this.searches = searches;
49 this.options = options;
50 this.timeout = timeout;
51 this.searchOrder = searchOrder;
52 }
53
54 String domain() {
55 return domain;
56 }
57
58 InetSocketAddress[] nameservers() {
59 return nameservers;
60 }
61
62 int port() {
63 return port;
64 }
65
66 String[] searches() {
67 return searches;
68 }
69
70 String options() {
71 return options;
72 }
73
74 int timeout() {
75 return timeout;
76 }
77
78 int searchOrder() {
79 return searchOrder;
80 }
81 }