public class DNSRecordUtils extends Object
| Constructor and Description |
|---|
DNSRecordUtils() |
| Modifier and Type | Method and Description |
|---|---|
static DNSRecord |
createARecord(String name,
long ttl,
String ip)
Creates a DNS A type record.
|
static DNSRecord |
createMXRecord(String name,
String target,
long ttl,
int priority)
Creates a DNS MX record.
|
static DNSRecord |
createSOARecord(String name,
long ttl,
String nameServer,
String hostMaster,
int serial,
long refresh,
long retry,
long expire,
long minumum)
Create a DNS SOA record.
|
static DNSRecord |
createSRVRecord(String name,
String target,
long ttl,
int port,
int priority,
int weight)
Create a DNS SRV type record.
|
static DNSRecord |
createX509CERTRecord(String address,
long ttl,
X509Certificate cert)
Creates a DNS CERT record containing an X509 public certificate.
|
static DNSRecord |
fromWire(byte[] data)
Converts a raw wire transfer format of a record to a DNS record.
|
static byte[] |
toWire(DNSRecord rec)
Converts a DNS record to a raw wire transfer format.
|
public static DNSRecord createARecord(String name, long ttl, String ip) throws ConfigurationStoreException
name - The record name. Generally a fully qualified domain name such as host.example.com.ttl - The time to live in seconds.ip - The ip4 address that the name will resolve.ConfigurationStoreExceptionpublic static DNSRecord createSRVRecord(String name, String target, long ttl, int port, int priority, int weight) throws ConfigurationStoreException
name - The service name.target - The target name that is hosting the service.ttl - The time to live in seconds.port - The port that the service is offered on.priority - The priority of the service. Lower priorities are preferred.weight - A value used to select between services with the same priority.ConfigurationStoreExceptionpublic static DNSRecord createX509CERTRecord(String address, long ttl, X509Certificate cert) throws ConfigurationStoreException
address - The name or address corresponding to the certificate.ttl - The time to live in seconds.cert - The X509 public certificate to be stored with the name/address.ConfigurationStoreExceptionpublic static DNSRecord createMXRecord(String name, String target, long ttl, int priority) throws ConfigurationStoreException
name - The email domain or host used to determine where email should be sent to.target - The host server that email should be sent to.ttl - The time to live in seconds.priority - The priority of the target host. Lower priorities are preferred.ConfigurationStoreExceptionpublic static DNSRecord createSOARecord(String name, long ttl, String nameServer, String hostMaster, int serial, long refresh, long retry, long expire, long minumum)
name - The root name of the zone.ttl - The time to live in seconds.nameServer - Name of the server that responds authoritatively to this zone.hostMaster - The email address of the administrator of the zone. The @ symbol is replaced with a "."serial - The current serial number of record.refresh - The time in seconds the a slave server tries to refresh its information from the master.retry - The time in seconds that a slave server retires after a failed refresh.expire - Time in seconds when the zone data is not longer authoritative.minumum - See RFC 2308.public static byte[] toWire(DNSRecord rec) throws IOException
rec - The DNSRecord to convert.IOExceptionpublic static DNSRecord fromWire(byte[] data) throws IOException
data - The raw byte stream of a record in wire transfer format.IOExceptionCopyright © 2021. All rights reserved.