当前位置: 首页>>代码示例>>Java>>正文


Java SRV类代码示例

本文整理汇总了Java中de.measite.minidns.record.SRV的典型用法代码示例。如果您正苦于以下问题:Java SRV类的具体用法?Java SRV怎么用?Java SRV使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SRV类属于de.measite.minidns.record包,在下文中一共展示了SRV类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveSrv

import de.measite.minidns.record.SRV; //导入依赖的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;
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:19,代码来源:Resolver.java

示例2: resolveIp

import de.measite.minidns.record.SRV; //导入依赖的package包/类
private static <D extends InternetAddressRR> List<Result> resolveIp(SRV srv, Class<D> type, boolean authenticated, boolean directTls) {
    if (Thread.currentThread().isInterrupted()) {
        return Collections.emptyList();
    }
    List<Result> list = new ArrayList<>();
    try {
        ResolverResult<D> results = resolveWithFallback(srv.name,type, authenticated);
        for (D record : results.getAnswersOrEmptySet()) {
            Result resolverResult = Result.fromRecord(srv, directTls);
            resolverResult.authenticated = results.isAuthenticData() && authenticated;
            resolverResult.ip = record.getInetAddress();
            list.add(resolverResult);
        }
    } catch (Throwable t) {
        Log.d(Config.LOGTAG,Resolver.class.getSimpleName()+": error resolving "+type.getSimpleName()+" "+t.getMessage());
    }
    return list;
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:19,代码来源:Resolver.java

示例3: resolveSrv

import de.measite.minidns.record.SRV; //导入依赖的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;
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:19,代码来源:Resolver.java

示例4: resolveIp

import de.measite.minidns.record.SRV; //导入依赖的package包/类
private static <D extends InternetAddressRR> List<Result> resolveIp(SRV srv, Class<D> type, boolean authenticated, boolean directTls) {
    if (Thread.currentThread().isInterrupted()) {
        return Collections.emptyList();
    }
    List<Result> list = new ArrayList<>();
    try {
        ResolverResult<D> results = resolveWithFallback(srv.name, type, authenticated);
        for (D record : results.getAnswersOrEmptySet()) {
            Result resolverResult = Result.fromRecord(srv, directTls);
            resolverResult.authenticated = results.isAuthenticData() && authenticated;
            resolverResult.ip = record.getInetAddress();
            list.add(resolverResult);
        }
    } catch (Throwable t) {
        Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": error resolving " + type.getSimpleName() + " " + t.getMessage());
    }
    return list;
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:19,代码来源:Resolver.java

示例5: resolveSrv

import de.measite.minidns.record.SRV; //导入依赖的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;
}
 
开发者ID:siacs,项目名称:Conversations,代码行数:19,代码来源:Resolver.java

示例6: resolveIp

import de.measite.minidns.record.SRV; //导入依赖的package包/类
private static <D extends InternetAddressRR> List<Result> resolveIp(SRV srv, Class<D> type, boolean authenticated, boolean directTls) {
	if (Thread.currentThread().isInterrupted()) {
		return Collections.emptyList();
	}
	List<Result> list = new ArrayList<>();
	try {
		ResolverResult<D> results = resolveWithFallback(srv.name, type, authenticated);
		for (D record : results.getAnswersOrEmptySet()) {
			Result resolverResult = Result.fromRecord(srv, directTls);
			resolverResult.authenticated = results.isAuthenticData() && authenticated;
			resolverResult.ip = record.getInetAddress();
			list.add(resolverResult);
		}
	} catch (Throwable t) {
		Log.d(Config.LOGTAG, Resolver.class.getSimpleName() + ": error resolving " + type.getSimpleName() + " " + t.getMessage());
	}
	return list;
}
 
开发者ID:siacs,项目名称:Conversations,代码行数:19,代码来源:Resolver.java

示例7: fromRecord

import de.measite.minidns.record.SRV; //导入依赖的package包/类
public static Result fromRecord(SRV srv, boolean directTls) {
    Result result = new Result();
    result.port = srv.port;
    result.hostname = srv.name;
    result.directTls = directTls;
    result.priority = srv.priority;
    return result;
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:9,代码来源:Resolver.java

示例8: lookupSRVRecords

import de.measite.minidns.record.SRV; //导入依赖的package包/类
@Override
public List<SRVRecord> lookupSRVRecords(String name) {
    List<SRVRecord> res = new LinkedList<SRVRecord>();
    DNSMessage message = client.query(name, TYPE.SRV, CLASS.IN);
    if (message == null) {
        return res;
    }
    for (Record record : message.getAnswers()) {
        SRV srv = (SRV) record.getPayload();
        res.add(new SRVRecord(srv.getName(), srv.getPort(), srv.getPriority(), srv.getWeight()));
    }
    return res;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:14,代码来源:MiniDnsResolver.java

示例9: fromRecord

import de.measite.minidns.record.SRV; //导入依赖的package包/类
public static Result fromRecord(SRV srv, boolean directTls) {
	Result result = new Result();
	result.port = srv.port;
	result.hostname = srv.name;
	result.directTls = directTls;
	result.priority = srv.priority;
	return result;
}
 
开发者ID:siacs,项目名称:Conversations,代码行数:9,代码来源:Resolver.java

示例10: fillSrvMaps

import de.measite.minidns.record.SRV; //导入依赖的package包/类
private static void fillSrvMaps(final String qname, final InetAddress dnsServer, final Map<Integer, List<TlsSrv>> priorities, final Map<String, List<String>> ips4, final Map<String, List<String>> ips6, final boolean tls) throws IOException {
	final DNSMessage message = client.query(qname, TYPE.SRV, CLASS.IN, dnsServer.getHostAddress());
	for (Record[] rrset : new Record[][] { message.getAnswers(), message.getAdditionalResourceRecords() }) {
		for (Record rr : rrset) {
			Data d = rr.getPayload();
			if (d instanceof SRV && NameUtil.idnEquals(qname, rr.getName())) {
				SRV srv = (SRV) d;
				if (!priorities.containsKey(srv.getPriority())) {
					priorities.put(srv.getPriority(),new ArrayList<TlsSrv>());
				}
				priorities.get(srv.getPriority()).add(new TlsSrv(srv, tls));
			}
			if (d instanceof A) {
				A a = (A) d;
				if (!ips4.containsKey(rr.getName())) {
					ips4.put(rr.getName(), new ArrayList<String>());
				}
				ips4.get(rr.getName()).add(a.toString());
			}
			if (d instanceof AAAA) {
				AAAA aaaa = (AAAA) d;
				if (!ips6.containsKey(rr.getName())) {
					ips6.put(rr.getName(), new ArrayList<String>());
				}
				ips6.get(rr.getName()).add("[" + aaaa.toString() + "]");
			}
		}
	}
}
 
开发者ID:Frozenbox,项目名称:frozenchat,代码行数:30,代码来源:DNSHelper.java

示例11: TlsSrv

import de.measite.minidns.record.SRV; //导入依赖的package包/类
public TlsSrv(SRV srv, boolean tls) {
	this.srv = srv;
	this.tls = tls;
}
 
开发者ID:Frozenbox,项目名称:frozenchat,代码行数:5,代码来源:DNSHelper.java

示例12: parse

import de.measite.minidns.record.SRV; //导入依赖的package包/类
/**
 * Parse a given record based on the full message data and the current
 * stream position.
 * @param dis The DataInputStream positioned at the first record byte.
 * @param data The full message data.
 * @throws IOException In case of malformed replies.
 */
public void parse(DataInputStream dis, byte[] data) throws IOException {
    this.name = NameUtil.parse(dis, data);
    this.type = TYPE.getType(dis.readUnsignedShort());
    int clazzValue = dis.readUnsignedShort();
    this.clazz = CLASS.getClass(clazzValue & 0x7fff);
    this.unicastQuery = (clazzValue & 0x8000) > 0;
    if (this.clazz == null) {
        LOGGER.log(Level.FINE, "Unknown class " + clazzValue);
    }
    this.ttl = (((long)dis.readUnsignedShort()) << 32) +
               dis.readUnsignedShort();
    int payloadLength = dis.readUnsignedShort();
    switch (this.type) {
    case SRV:
        this.payloadData = new SRV();
        break;
    case AAAA:
        this.payloadData = new AAAA();
        break;
    case A:
        this.payloadData = new A();
        break;
    case NS:
        this.payloadData = new NS();
        break;
    case CNAME:
        this.payloadData = new CNAME();
        break;
    case PTR:
        this.payloadData = new PTR();
        break;
    case TXT:
        this.payloadData = new TXT();
        break;
    default:
        LOGGER.log(Level.FINE, "Unparsed type " + type);
        this.payloadData = null;
        for (int i = 0; i < payloadLength; i++) {
            dis.readByte();
        }
        break;
    }
    if (this.payloadData != null) {
        this.payloadData.parse(dis, data, payloadLength);
    }
}
 
开发者ID:juanignaciomolina,项目名称:txtr,代码行数:54,代码来源:Record.java


注:本文中的de.measite.minidns.record.SRV类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。