use of de.dytanic.cloudnet.cloudflare.util.DNSRecord in project CloudNet by Dytanic.
the class CloudFlareService method bootstrap.
@Deprecated
public boolean bootstrap(Map<String, SimpledWrapperInfo> wrapperInfoMap, Map<String, ProxyGroup> groups, CloudFlareDatabase cloudFlareDatabase) {
if (!cloudFlareConfig.isEnabled())
return false;
for (String id : cloudFlareDatabase.getAndRemove()) this.deleteRecord(id);
for (String key : cloudFlareDatabase.getAll()) {
if (!key.equalsIgnoreCase(Database.UNIQUE_NAME_KEY) && !wrapperInfoMap.containsKey(key)) {
deleteRecord(cloudFlareDatabase.getResponse(key).getId());
}
}
for (CloudFlareProxyGroup cloudFlareProxyGroup : cloudFlareConfig.getGroups()) {
ProxyGroup proxyGroup = groups.get(cloudFlareProxyGroup.getName());
for (String wrapper : proxyGroup.getWrapper()) {
if (!cloudFlareDatabase.contains(wrapper)) {
String host = wrapperInfoMap.get(wrapper).getHostName();
DNSRecord dnsRecord = new DefaultDNSRecord(DNSType.A, wrapper + "." + cloudFlareConfig.getDomainName(), host, new Document().obj());
if (!ipARecords.containsKey(wrapper)) {
PostResponse postResponse = this.createRecord(dnsRecord);
ipARecords.put(wrapper, postResponse);
cloudFlareDatabase.putPostResponse(wrapper, postResponse);
NetworkUtils.sleepUninterruptedly(400);
}
}
}
}
return true;
}
Aggregations