package org.cnhawk;
import org.xbill.DNS.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
public class LookDNSMX{
private Resolver resolver;
private Cache cache;
private int DNSCredibility;
private static LookDNSMX instance=null;
private Collection DNSServers = new Vector();
//构造函数
public LookDNSMX() throws Exception{
this.initialize();
}
public static LookDNSMX getInstance() throws Exception{
if(instance==null)
instance=new LookDNSMX();
return instance;
}
//初始化
public void initialize() throws Exception {
DNSServers.add("10.0.1.1");
final String serversArray[] = (String[])DNSServers.toArray(new String[0]);
System.out.println("Current DNS server is : "+serversArray[0].toString());
try {
resolver = new ExtendedResolver(serversArray );
} catch (UnknownHostException uhe) {
throw uhe;
}
cache = new Cache (DClass.IN);
}
//主方法
public synchronized Coll