1700478739
recorder=upperServer.resolve(domain);
1700478740
1700478741
}
1700478742
1700478743
return recorder;
1700478744
1700478745
}
1700478746
1700478747
//指向上级DNS
1700478748
1700478749
public void setUpperServer(DnsServer_upperServer){
1700478750
1700478751
this.upperServer=_upperServer;
1700478752
1700478753
}
1700478754
1700478755
//每个DNS都有一个数据处理区(ZONE),检查域名是否在本区中
1700478756
1700478757
protected abstract boolean isLocal(String domain);
1700478758
1700478759
//每个DNS服务器都必须实现解析任务
1700478760
1700478761
protected Recorder echo(String domain){
1700478762
1700478763
Recorder recorder=new Recorder();
1700478764
1700478765
//获得IP地址
1700478766
1700478767
recorder.setIp(genIpAddress());
1700478768
1700478769
recorder.setDomain(domain);
1700478770
1700478771
return recorder;
1700478772
1700478773
}
1700478774
1700478775
//随机产生一个IP地址,工具类
1700478776
1700478777
private String genIpAddress(){
1700478778
1700478779
Random rand=new Random();
1700478780
1700478781
String address=rand.nextInt(255)+”.”+rand.nextInt(255)+”.”+
1700478782
1700478783
rand.nextInt(255)+”.”+rand.nextInt(255);
1700478784
1700478785
return address;
1700478786
1700478787
}
1700478788
[
上一页 ]
[ :1.700478739e+09 ]
[
下一页 ]