Package tigase.util.dns
Class DNSEntry
- java.lang.Object
-
- tigase.util.dns.DNSEntry
-
- All Implemented Interfaces:
java.lang.Comparable<DNSEntry>
public class DNSEntry extends java.lang.Object implements java.lang.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(java.lang.String hostname, java.lang.String ip)
Constructs DNS entry with hostname and IP to which it resolves.DNSEntry(java.lang.String hostname, java.lang.String[] ips)
Constructs DNS entry with hostname and multiple IP to which it resolves.DNSEntry(java.lang.String hostname, java.lang.String[] ips, int port)
Constructs DNS entry with hostname, IPs to which it resolves and a default port number used for connections.DNSEntry(java.lang.String hostname, java.lang.String ip, int port)
Constructs DNS entry with hostname, IP to which it resolves and a default port number used for connections.DNSEntry(java.lang.String hostname, java.lang.String dnsResultHost, java.lang.String[] ips, int port, long ttl, int priority, int weight)
Constructs complete SRV DNS entry.DNSEntry(java.lang.String hostname, java.lang.String dnsResultHost, java.lang.String ip, int port, long ttl, int priority, int weight)
Constructs complete SRV DNS entry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(DNSEntry o)
java.lang.String
getDnsResultHost()
Returns the domain name for which this record is validjava.lang.String
getHostname()
Returns the canonical hostname of the machine providing the service.java.lang.String
getIp()
ReturnsIP address
of the machine providing the service.java.lang.String[]
getIps()
Returns array containing allIP addresses
on which service is available (in case hostname resolves to multiple IPs)int
getPort()
Returns the TCP or UDP port on which the service is to be foundint
getPriority()
Returns the priority of the target host, lower value means more preferred.long
getTtl()
Returns standard DNS time to live field.int
getWeight()
Returns relative weight for records with the same priority.java.lang.String
toString()
Returns string interpretation of the DNS entry
-
-
-
Constructor Detail
-
DNSEntry
public DNSEntry(java.lang.String hostname, java.lang.String ip)
Constructs DNS entry with hostname and IP to which it resolves.- Parameters:
hostname
- the domain name for which this record is validip
-IP address
of the machine providing the service.
-
DNSEntry
public DNSEntry(java.lang.String hostname, java.lang.String[] ips)
Constructs DNS entry with hostname and multiple IP to which it resolves.- Parameters:
hostname
- the domain name for which this record is validips
- Array of allIP addresses
on which target host provide service.
-
DNSEntry
public DNSEntry(java.lang.String hostname, java.lang.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 validip
-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(java.lang.String hostname, java.lang.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 validips
-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(java.lang.String hostname, java.lang.String dnsResultHost, java.lang.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 validdnsResultHost
- 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 foundttl
- 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(java.lang.String hostname, java.lang.String dnsResultHost, java.lang.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 validdnsResultHost
- the canonical hostname of the machine providing the service.ips
- Array of allIP addresses
on which target host provide service.port
- the TCP or UDP port on which the service is to be foundttl
- 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 Detail
-
getDnsResultHost
public java.lang.String getDnsResultHost()
Returns the domain name for which this record is valid- Returns:
- the domain name for which this record is valid
-
getHostname
public java.lang.String getHostname()
Returns the canonical hostname of the machine providing the service.- Returns:
- the canonical hostname of the machine providing the service.
-
getIp
public java.lang.String getIp()
ReturnsIP address
of the machine providing the service.- Returns:
IP address
of the machine providing the service.
-
getIps
public java.lang.String[] getIps()
Returns array containing allIP 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 java.lang.String toString()
Returns string interpretation of the DNS entry- Overrides:
toString
in classjava.lang.Object
- Returns:
- string interpretation of the DNS entry
-
-