Class DNSEntry

java.lang.Object
tigase.util.dns.DNSEntry
All Implemented Interfaces:
Comparable<DNSEntry>

public class DNSEntry extends Object implements Comparable<DNSEntry>
The class defines an instance of a single DNS entry.
Since:
Dec 19, 2009 10:29:23 PM
Author:
Artur Hefczyc
  • Constructor Summary

    Constructors
    Constructor
    Description
    DNSEntry(String hostname, String ip)
    Constructs DNS entry with hostname and IP to which it resolves.
    DNSEntry(String hostname, String[] ips)
    Constructs DNS entry with hostname and multiple IP to which it resolves.
    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.
    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.
    DNSEntry(String hostname, String dnsResultHost, String[] ips, int port, long ttl, int priority, int weight)
    Constructs complete SRV DNS entry.
    DNSEntry(String hostname, String dnsResultHost, String ip, int port, long ttl, int priority, int weight)
    Constructs complete SRV DNS entry.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    Returns the domain name for which this record is valid
    Returns the canonical hostname of the machine providing the service.
    Returns IP address of the machine providing the service.
    Returns array containing all IP addresses on which service is available (in case hostname resolves to multiple IPs)
    int
    Returns the TCP or UDP port on which the service is to be found
    int
    Returns the priority of the target host, lower value means more preferred.
    long
    Returns standard DNS time to live field.
    int
    Returns relative weight for records with the same priority.
    Returns string interpretation of the DNS entry

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • 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
      ip - IP 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
      ip - IP 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
      ips - IP 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.
      ip - IP 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.
  • Method Details

    • 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
      Overrides:
      toString in class Object
      Returns:
      string interpretation of the DNS entry
    • compareTo

      public int compareTo(DNSEntry o)
      Specified by:
      compareTo in interface Comparable<DNSEntry>