Package tigase.util.dns
Class DNSEntry
java.lang.Object
tigase.util.dns.DNSEntry
- All Implemented Interfaces:
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
ConstructorDescriptionConstructs DNS entry with hostname and IP to which it resolves.Constructs DNS entry with hostname and multiple IP to which it resolves.Constructs DNS entry with hostname, IPs to which it resolves and a default port number used for connections.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 TypeMethodDescriptionint
Returns the domain name for which this record is validReturns the canonical hostname of the machine providing the service.getIp()
ReturnsIP address
of the machine providing the service.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
Returns the priority of the target host, lower value means more preferred.long
getTtl()
Returns standard DNS time to live field.int
Returns relative weight for records with the same priority.toString()
Returns string interpretation of the DNS entry
-
Constructor Details
-
DNSEntry
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
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
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
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(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 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(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 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 Details
-
getDnsResultHost
Returns the domain name for which this record is valid- Returns:
- the domain name for which this record is valid
-
getHostname
Returns the canonical hostname of the machine providing the service.- Returns:
- the canonical hostname of the machine providing the service.
-
getIp
ReturnsIP address
of the machine providing the service.- Returns:
IP address
of the machine providing the service.
-
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
Returns string interpretation of the DNS entry -
compareTo
- Specified by:
compareTo
in interfaceComparable<DNSEntry>
-