DNSEntry

public class DNSEntry implements Comparable<DNSEntry>

The class defines an instance of a single DNS entry.

Author:Artur Hefczyc

Constructors

DNSEntry

public DNSEntry(String hostname, String ip)

Constructs DNS entry with hostname and IP to which it resolves.

Parameters:
  • hostname – the domain name for which this record is valid
  • ipIP address of the machine providing the service.

DNSEntry

public DNSEntry(String hostname, String[] ips)

Constructs DNS entry with hostname and multiple IP to which it resolves.

Parameters:
  • hostname – the domain name for which this record is valid
  • ips – Array of all IP addresses on which target host provide service.

DNSEntry

public DNSEntry(String hostname, String ip, int port)

Constructs DNS entry with hostname, IP to which it resolves and a default port number used for connections.

Parameters:
  • hostname – the domain name for which this record is valid
  • ipIP address of the machine providing the service.
  • port – the TCP or UDP port on which the service is to be found

DNSEntry

public DNSEntry(String hostname, String[] ips, int port)

Constructs DNS entry with hostname, IPs to which it resolves and a default port number used for connections.

Parameters:
  • hostname – the domain name for which this record is valid
  • ipsIP addresses of the machines providing the service.
  • port – the TCP or UDP port on which the service is to be found

DNSEntry

public DNSEntry(String hostname, String dnsResultHost, String ip, int port, long ttl, int priority, int weight)

Constructs complete SRV DNS entry.

Parameters:
  • hostname – the domain name for which this record is valid
  • dnsResultHost – the canonical hostname of the machine providing the service.
  • ipIP address of the machine providing the service.
  • port – the TCP or UDP port on which the service is to be found
  • ttl – standard DNS time to live field.
  • priority – the priority of the target host, lower value means more preferred.
  • weight – relative weight for records with the same priority.

DNSEntry

public DNSEntry(String hostname, String dnsResultHost, String[] ips, int port, long ttl, int priority, int weight)

Constructs complete SRV DNS entry.

Parameters:
  • hostname – the domain name for which this record is valid
  • dnsResultHost – the canonical hostname of the machine providing the service.
  • ips – Array of all IP addresses on which target host provide service.
  • port – the TCP or UDP port on which the service is to be found
  • ttl – standard DNS time to live field.
  • priority – the priority of the target host, lower value means more preferred.
  • weight – relative weight for records with the same priority.

Methods

compareTo

public int compareTo(DNSEntry o)

getDnsResultHost

public String getDnsResultHost()

Returns the domain name for which this record is valid

Returns:the domain name for which this record is valid

getHostname

public String getHostname()

Returns the canonical hostname of the machine providing the service.

Returns:the canonical hostname of the machine providing the service.

getIp

public String getIp()

Returns IP address of the machine providing the service.

Returns:IP address of the machine providing the service.

getIps

public String[] getIps()

Returns array containing all IP addresses on which service is available (in case hostname resolves to multiple IPs)

Returns:array containing all IP addresses on which service is available

getPort

public int getPort()

Returns the TCP or UDP port on which the service is to be found

Returns:the TCP or UDP port on which the service is to be found

getPriority

public int getPriority()

Returns the priority of the target host, lower value means more preferred.

Returns:the priority of the target host, lower value means more preferred.

getTtl

public long getTtl()

Returns standard DNS time to live field.

Returns:standard DNS time to live field.

getWeight

public int getWeight()

Returns relative weight for records with the same priority.

Returns:relative weight for records with the same priority.

toString

public String toString()

Returns string interpretation of the DNS entry

Returns:string interpretation of the DNS entry