本文整理汇总了Java中org.xbill.DNS.NSRecord类的典型用法代码示例。如果您正苦于以下问题:Java NSRecord类的具体用法?Java NSRecord怎么用?Java NSRecord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSRecord类属于org.xbill.DNS包,在下文中一共展示了NSRecord类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: makeNameServerSet
import org.xbill.DNS.NSRecord; //导入依赖的package包/类
private RRset makeNameServerSet(DomainResource domain) {
RRset nameServerSet = new RRset();
for (String hostName : domain.loadNameserverFullyQualifiedHostNames()) {
NSRecord record =
new NSRecord(
toAbsoluteName(domain.getFullyQualifiedDomainName()),
DClass.IN,
dnsDefaultNsTtl.getStandardSeconds(),
toAbsoluteName(hostName));
nameServerSet.addRR(record);
}
return nameServerSet;
}
开发者ID:google,项目名称:nomulus,代码行数:14,代码来源:DnsUpdateWriter.java
示例2: canResolveRecord
import org.xbill.DNS.NSRecord; //导入依赖的package包/类
@Test
public void canResolveRecord() throws Exception {
AcceptanceTestRunner runner = new AcceptanceTestRunner();
runner.runUngarded(new AcceptanceScenario() {
public void run(WebDriver driver, String deployedURL) throws Exception {
int id = new SecureRandom().nextInt();
final String systemTestBase = "system-tests.onomate.test";
final String soaBase = "soa-" + id +"."+ systemTestBase;
final String ns = "ns." + soaBase;
final String contactName = "admin." + soaBase;
final String aTestRecordHost = "record."+soaBase;
final String aTestRecordNS = "ns.test";
OnomateAssembly assembly = new OnomateAssembly(driver, deployedURL);
OnomateAssembly.Dashboard board = assembly.gotoLanding().authenticate().newAuthority(soaBase, ns, contactName);
board.authorityByZone(soaBase).details().createRecord(aTestRecordHost, OnomateAssembly.RecordType.NS, aTestRecordNS);
Options.set("verbose");
SimpleResolver resolver = new SimpleResolver();
resolver.setAddress(InetAddress.getLocalHost());
resolver.setPort(9101);
Record query = Record.newRecord(Name.fromString(aTestRecordHost + "."), Type.NS, DClass.IN);
Message question = Message.newQuery(query);
Message response = resolver.send(question);
Record responses[] = response.getSectionArray(Section.AUTHORITY);
NSRecord record = ((NSRecord) responses[0]);
assertEquals(record.getName().toString(), aTestRecordHost+ ".");
assertEquals(record.getTarget().toString(), aTestRecordNS + ".");
}
});
}
开发者ID:meschbach,项目名称:onomate,代码行数:35,代码来源:CreateNSRecordTests.java
示例3: lookup
import org.xbill.DNS.NSRecord; //导入依赖的package包/类
private Message lookup(Set<Name> stack, String[] addresses, Message query) throws IOException {
Message msg = getCached(query);
if (msg != null)
return msg;
if (addresses == null)
return null;
Resolver resolver = createResolver(addresses);
try {
msg = resolver.send(query);
} catch (IOException e) {
return null;
}
if (msg == null)
return null;
// Found the authoritative answer
if (msg.getHeader().getFlag(Flags.AA))
return msg;
Record[] authority = msg.getSectionArray(Section.AUTHORITY);
for (Record record : authority) {
if (Type.NS == record.getType()) {
Name nameserver = ((NSRecord)record).getTarget();
// Try to find glue for the record first
Record[] additional = msg.getSectionArray(Section.ADDITIONAL);
addresses = findAddresses(nameserver, additional);
if (stack.contains(nameserver)) // Loop - cannot go there
continue;
stack.add(nameserver);
if (stack.size() > MAX_RECURSION_STACK) // Prevent recursion spinning out of control
return null;
// No glue found - lookup target recursively
if (addresses == null)
addresses = findAddressesRecursive(stack, nameserver);
// Chase down to the next level
Message resp = lookup(stack, addresses, query);
if (resp != null) {
addCached(resp);
return resp;
}
}
}
return null; // Just couldn't do it
}
开发者ID:wnagele,项目名称:dnsjava-recursive-resolver,代码行数:51,代码来源:RecursiveResolver.java
示例4: beforeTestMethod
import org.xbill.DNS.NSRecord; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void beforeTestMethod(final TestContext testContext) throws Exception {
super.beforeTestMethod(testContext);
final JUnitDNSServer config = findTestAnnotation(JUnitDNSServer.class, testContext);
if (config == null) {
return;
}
LogUtils.infof(this, "initializing DNS on port %d", config.port());
m_server = new DNSServer();
m_server.addPort(config.port());
for (final DNSZone dnsZone : config.zones()) {
String name = dnsZone.name();
if (!name.endsWith(".")) {
name = name + ".";
}
final Name zoneName = Name.fromString(name, Name.root);
LogUtils.debugf(this, "zoneName = %s", zoneName);
final Zone zone = new Zone(zoneName, new Record[] {
new SOARecord(zoneName, DClass.IN, DEFAULT_TTL, zoneName, Name.fromString("admin." + name), 1, DEFAULT_TTL, DEFAULT_TTL, DEFAULT_TTL, DEFAULT_TTL),
new NSRecord(zoneName, DClass.IN, DEFAULT_TTL, Name.fromString("resolver1.opendns.com.")),
new NSRecord(zoneName, DClass.IN, DEFAULT_TTL, Name.fromString("resolver2.opendns.com.")),
new ARecord(zoneName, DClass.IN, DEFAULT_TTL, InetAddressUtils.addr(dnsZone.v4address())),
new AAAARecord(zoneName, DClass.IN, DEFAULT_TTL, InetAddressUtils.addr(dnsZone.v6address()))
});
LogUtils.debugf(this, "zone = %s", zone);
for (final DNSEntry entry : dnsZone.entries()) {
LogUtils.debugf(this, "adding entry: %s", entry);
String hostname = entry.hostname();
final Name recordName = Name.fromString(hostname, zoneName);
LogUtils.debugf(this, "name = %s", recordName);
if (entry.ipv6()) {
zone.addRecord(new AAAARecord(recordName, DClass.IN, DEFAULT_TTL, InetAddressUtils.addr(entry.address())));
} else {
zone.addRecord(new ARecord(recordName, DClass.IN, DEFAULT_TTL, InetAddressUtils.addr(entry.address())));
}
}
m_server.addZone(zone);
}
LogUtils.debugf(this, "starting DNS server");
m_server.start();
try {
Thread.sleep(50);
} catch (final InterruptedException e) {
LogUtils.debugf(this, e, "interrupted while waiting for server to come up");
Thread.currentThread().interrupt();
}
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:57,代码来源:JUnitDNSServerExecutionListener.java
示例5: getNSRecord
import org.xbill.DNS.NSRecord; //导入依赖的package包/类
public static NSRecord getNSRecord(String domainName) {
return null;
}
开发者ID:sensepost,项目名称:yeti,代码行数:4,代码来源:DNS.java
示例6: getNSRecord
import org.xbill.DNS.NSRecord; //导入依赖的package包/类
public NSRecord getNSRecord(String domainName) {
return null;
}
开发者ID:sensepost,项目名称:yeti,代码行数:4,代码来源:DataAPI.java
注:本文中的org.xbill.DNS.NSRecord类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论