本文整理汇总了Java中de.measite.minidns.DNSName类的典型用法代码示例。如果您正苦于以下问题:Java DNSName类的具体用法?Java DNSName怎么用?Java DNSName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DNSName类属于de.measite.minidns包,在下文中一共展示了DNSName类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveSrv
import de.measite.minidns.DNSName; //导入依赖的package包/类
private static List<Result> resolveSrv(String domain, final boolean directTls) throws IOException {
if (Thread.currentThread().isInterrupted()) {
return Collections.emptyList();
}
DNSName dnsName = DNSName.from((directTls ? DIRECT_TLS_SERVICE : STARTTLS_SERICE)+"._tcp."+domain);
ResolverResult<SRV> result = resolveWithFallback(dnsName,SRV.class);
List<Result> results = new ArrayList<>();
for(SRV record : result.getAnswersOrEmptySet()) {
final boolean addedIPv4 = results.addAll(resolveIp(record,A.class,result.isAuthenticData(),directTls));
results.addAll(resolveIp(record,AAAA.class,result.isAuthenticData(),directTls));
if (!addedIPv4 && !Thread.currentThread().isInterrupted()) {
Result resolverResult = Result.fromRecord(record, directTls);
resolverResult.authenticated = resolverResult.isAuthenticated();
results.add(resolverResult);
}
}
return results;
}
示例2: resolveNoSrvRecords
import de.measite.minidns.DNSName; //导入依赖的package包/类
private static List<Result> resolveNoSrvRecords(DNSName dnsName, boolean withCnames) {
List<Result> results = new ArrayList<>();
try {
for(A a : resolveWithFallback(dnsName,A.class,false).getAnswersOrEmptySet()) {
results.add(Result.createDefault(dnsName,a.getInetAddress()));
}
for(AAAA aaaa : resolveWithFallback(dnsName,AAAA.class,false).getAnswersOrEmptySet()) {
results.add(Result.createDefault(dnsName,aaaa.getInetAddress()));
}
if (results.size() == 0 && withCnames) {
for (CNAME cname : resolveWithFallback(dnsName, CNAME.class, false).getAnswersOrEmptySet()) {
results.addAll(resolveNoSrvRecords(cname.name, false));
}
}
} catch (Throwable throwable) {
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + "error resolving fallback records",throwable);
}
results.add(Result.createDefault(dnsName));
return results;
}
示例3: resolveSrv
import de.measite.minidns.DNSName; //导入依赖的package包/类
private static List<Result> resolveSrv(String domain, final boolean directTls) throws IOException {
if (Thread.currentThread().isInterrupted()) {
return Collections.emptyList();
}
DNSName dnsName = DNSName.from((directTls ? DIRECT_TLS_SERVICE : STARTTLS_SERICE) + "._tcp." + domain);
ResolverResult<SRV> result = resolveWithFallback(dnsName, SRV.class);
List<Result> results = new ArrayList<>();
for (SRV record : result.getAnswersOrEmptySet()) {
final boolean addedIPv4 = results.addAll(resolveIp(record, A.class, result.isAuthenticData(), directTls));
results.addAll(resolveIp(record, AAAA.class, result.isAuthenticData(), directTls));
if (!addedIPv4 && !Thread.currentThread().isInterrupted()) {
Result resolverResult = Result.fromRecord(record, directTls);
resolverResult.authenticated = resolverResult.isAuthenticated();
results.add(resolverResult);
}
}
return results;
}
示例4: resolveNoSrvRecords
import de.measite.minidns.DNSName; //导入依赖的package包/类
private static List<Result> resolveNoSrvRecords(DNSName dnsName, boolean withCnames) {
List<Result> results = new ArrayList<>();
try {
for (A a : resolveWithFallback(dnsName, A.class, false).getAnswersOrEmptySet()) {
results.add(Result.createDefault(dnsName, a.getInetAddress()));
}
for (AAAA aaaa : resolveWithFallback(dnsName, AAAA.class, false).getAnswersOrEmptySet()) {
results.add(Result.createDefault(dnsName, aaaa.getInetAddress()));
}
if (results.size() == 0 && withCnames) {
for (CNAME cname : resolveWithFallback(dnsName, CNAME.class, false).getAnswersOrEmptySet()) {
results.addAll(resolveNoSrvRecords(cname.name, false));
}
}
} catch (Throwable throwable) {
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + "error resolving fallback records", throwable);
}
results.add(Result.createDefault(dnsName));
return results;
}
示例5: resolveSrv
import de.measite.minidns.DNSName; //导入依赖的package包/类
private static List<Result> resolveSrv(String domain, final boolean directTls) throws IOException {
if (Thread.currentThread().isInterrupted()) {
return Collections.emptyList();
}
DNSName dnsName = DNSName.from((directTls ? DIRECT_TLS_SERVICE : STARTTLS_SERICE) + "._tcp." + domain);
ResolverResult<SRV> result = resolveWithFallback(dnsName, SRV.class);
List<Result> results = new ArrayList<>();
for (SRV record : result.getAnswersOrEmptySet()) {
final boolean addedIPv4 = results.addAll(resolveIp(record, A.class, result.isAuthenticData(), directTls));
results.addAll(resolveIp(record, AAAA.class, result.isAuthenticData(), directTls));
if (!addedIPv4 && !Thread.currentThread().isInterrupted()) {
Result resolverResult = Result.fromRecord(record, directTls);
resolverResult.authenticated = resolverResult.isAuthenticated();
results.add(resolverResult);
}
}
return results;
}
示例6: resolveNoSrvRecords
import de.measite.minidns.DNSName; //导入依赖的package包/类
private static List<Result> resolveNoSrvRecords(DNSName dnsName, boolean withCnames) {
List<Result> results = new ArrayList<>();
try {
for (A a : resolveWithFallback(dnsName, A.class, false).getAnswersOrEmptySet()) {
results.add(Result.createDefault(dnsName, a.getInetAddress()));
}
for (AAAA aaaa : resolveWithFallback(dnsName, AAAA.class, false).getAnswersOrEmptySet()) {
results.add(Result.createDefault(dnsName, aaaa.getInetAddress()));
}
if (results.size() == 0 && withCnames) {
for (CNAME cname : resolveWithFallback(dnsName, CNAME.class, false).getAnswersOrEmptySet()) {
results.addAll(resolveNoSrvRecords(cname.name, false));
}
}
} catch (Throwable throwable) {
Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + "error resolving fallback records", throwable);
}
results.add(Result.createDefault(dnsName));
return results;
}
示例7: createDefault
import de.measite.minidns.DNSName; //导入依赖的package包/类
public static Result createDefault(DNSName hostname, InetAddress ip) {
Result result = new Result();
result.port = 5222;
result.hostname = hostname;
result.ip = ip;
return result;
}
示例8: createDefault
import de.measite.minidns.DNSName; //导入依赖的package包/类
public static Result createDefault(DNSName hostname, InetAddress ip) {
Result result = new Result();
result.port = 5222;
result.hostname = hostname;
result.ip = ip;
return result;
}
示例9: fromCursor
import de.measite.minidns.DNSName; //导入依赖的package包/类
public static Result fromCursor(Cursor cursor) {
final Result result = new Result();
try {
result.ip = InetAddress.getByAddress(cursor.getBlob(cursor.getColumnIndex(IP)));
} catch (UnknownHostException e) {
result.ip = null;
}
result.hostname = DNSName.from(cursor.getString(cursor.getColumnIndex(HOSTNAME)));
result.port = cursor.getInt(cursor.getColumnIndex(PORT));
result.priority = cursor.getInt(cursor.getColumnIndex(PRIORITY));
result.authenticated = cursor.getInt(cursor.getColumnIndex(AUTHENTICATED)) > 0;
result.directTls = cursor.getInt(cursor.getColumnIndex(DIRECT_TLS)) > 0;
return result;
}
示例10: resolveWithFallback
import de.measite.minidns.DNSName; //导入依赖的package包/类
private static <D extends Data> ResolverResult<D> resolveWithFallback(DNSName dnsName, Class<D> type) throws IOException {
return resolveWithFallback(dnsName,type,validateHostname());
}
示例11: getHostname
import de.measite.minidns.DNSName; //导入依赖的package包/类
public DNSName getHostname() {
return hostname;
}
示例12: resolveWithFallback
import de.measite.minidns.DNSName; //导入依赖的package包/类
private static <D extends Data> ResolverResult<D> resolveWithFallback(DNSName dnsName, Class<D> type) throws IOException {
return resolveWithFallback(dnsName, type, validateHostname());
}
示例13: resolveWithFallback
import de.measite.minidns.DNSName; //导入依赖的package包/类
private static <D extends Data> ResolverResult<D> resolveWithFallback(DNSName dnsName, Class<D> type) throws IOException {
return resolveWithFallback(dnsName, type, validateHostname());
}
示例14: getHostname
import de.measite.minidns.DNSName; //导入依赖的package包/类
public DNSName getHostname() {
return hostname;
}