2005-09-18 00:01:24 +02:00
|
|
|
/**
|
|
|
|
*
|
2020-04-04 13:03:31 +02:00
|
|
|
* Copyright 2003-2005 Jive Software, 2016-2020 Florian Schmaus.
|
2005-09-18 00:01:24 +02:00
|
|
|
*
|
2014-02-17 18:57:38 +01:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
2005-09-18 00:01:24 +02:00
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
package org.jivesoftware.smack.util;
|
|
|
|
|
2013-03-18 09:53:11 +01:00
|
|
|
import org.jivesoftware.smack.util.dns.DNSResolver;
|
2017-06-14 17:12:43 +02:00
|
|
|
import org.jivesoftware.smack.util.dns.SmackDaneProvider;
|
2012-10-26 12:47:55 +02:00
|
|
|
|
2005-09-18 00:01:24 +02:00
|
|
|
/**
|
2013-03-18 09:53:11 +01:00
|
|
|
* Utility class to perform DNS lookups for XMPP services.
|
2005-09-18 00:01:24 +02:00
|
|
|
*
|
|
|
|
* @author Matt Tucker
|
2016-10-31 10:45:38 +01:00
|
|
|
* @author Florian Schmaus
|
2005-09-18 00:01:24 +02:00
|
|
|
*/
|
|
|
|
public class DNSUtil {
|
|
|
|
|
2013-03-18 09:53:11 +01:00
|
|
|
private static DNSResolver dnsResolver = null;
|
2016-10-31 10:45:38 +01:00
|
|
|
private static SmackDaneProvider daneProvider;
|
2005-09-18 00:01:24 +02:00
|
|
|
|
2013-03-18 09:53:11 +01:00
|
|
|
/**
|
|
|
|
* Set the DNS resolver that should be used to perform DNS lookups.
|
|
|
|
*
|
2019-08-30 12:08:30 +02:00
|
|
|
* @param resolver TODO javadoc me please
|
2013-03-18 09:53:11 +01:00
|
|
|
*/
|
|
|
|
public static void setDNSResolver(DNSResolver resolver) {
|
2016-10-31 10:45:38 +01:00
|
|
|
dnsResolver = Objects.requireNonNull(resolver);
|
2013-03-18 09:53:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current DNS resolved used to perform DNS lookups.
|
|
|
|
*
|
2014-03-10 18:31:45 +01:00
|
|
|
* @return the active DNSResolver
|
2013-03-18 09:53:11 +01:00
|
|
|
*/
|
|
|
|
public static DNSResolver getDNSResolver() {
|
|
|
|
return dnsResolver;
|
2005-09-18 00:01:24 +02:00
|
|
|
}
|
|
|
|
|
2016-10-31 10:45:38 +01:00
|
|
|
/**
|
|
|
|
* Set the DANE provider that should be used when DANE is enabled.
|
|
|
|
*
|
2019-08-30 12:08:30 +02:00
|
|
|
* @param daneProvider TODO javadoc me please
|
2016-10-31 10:45:38 +01:00
|
|
|
*/
|
|
|
|
public static void setDaneProvider(SmackDaneProvider daneProvider) {
|
2018-06-12 19:06:18 +02:00
|
|
|
DNSUtil.daneProvider = Objects.requireNonNull(daneProvider);
|
2016-10-31 10:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the currently active DANE provider used when DANE is enabled.
|
|
|
|
*
|
|
|
|
* @return the active DANE provider
|
|
|
|
*/
|
|
|
|
public static SmackDaneProvider getDaneProvider() {
|
|
|
|
return daneProvider;
|
|
|
|
}
|
2014-09-13 09:27:55 +02:00
|
|
|
|
2014-02-17 23:58:40 +01:00
|
|
|
}
|