Skip to content

Commit

Permalink
Update Main.java
Browse files Browse the repository at this point in the history
  • Loading branch information
RockyLOMO committed Jul 23, 2024
1 parent 6b264ec commit c96e896
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions rxlib/src/main/java/org/rx/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -335,26 +335,26 @@ static void launchServer(Map<String, String> options, Integer port, Integer conn
final SocksProxyServer proxyServer;

void ddns() {
Tasks.schedulePeriod(() -> {
if (conf == null) {
log.warn("conf is null");
}

InetAddress wanIp = InetAddress.getByName(IPSearcher.DEFAULT.currentIp());
for (String ddns : conf.ddnsDomains) {
List<InetAddress> currentIps = DnsClient.inlandClient().resolveAll(ddns);
if (currentIps.contains(wanIp)) {
continue;
}
int i = ddns.indexOf(".");
String domain = ddns.substring(i + 1), name = ddns.substring(0, i);
log.info("ddns-{}.{}: {}->{}", name, domain, currentIps, wanIp);
AuthenticProxy p = conf.godaddyProxy != null
? new AuthenticProxy(Proxy.Type.SOCKS, Sockets.parseEndpoint(conf.godaddyProxy))
: null;
IPSearcher.godaddyDns(conf.getGodaddyKey(), domain, name, wanIp.getHostAddress(), p);
}
}, conf.ddnsSeconds * 1000L);
// Tasks.schedulePeriod(() -> {
// if (conf == null) {
// log.warn("conf is null");
// }
//
// InetAddress wanIp = InetAddress.getByName(IPSearcher.DEFAULT.currentIp());
// for (String ddns : conf.ddnsDomains) {
// List<InetAddress> currentIps = DnsClient.inlandClient().resolveAll(ddns);
// if (currentIps.contains(wanIp)) {
// continue;
// }
// int i = ddns.indexOf(".");
// String domain = ddns.substring(i + 1), name = ddns.substring(0, i);
// log.info("ddns-{}.{}: {}->{}", name, domain, currentIps, wanIp);
// AuthenticProxy p = conf.godaddyProxy != null
// ? new AuthenticProxy(Proxy.Type.SOCKS, Sockets.parseEndpoint(conf.godaddyProxy))
// : null;
// IPSearcher.godaddyDns(conf.getGodaddyKey(), domain, name, wanIp.getHostAddress(), p);
// }
// }, conf.ddnsSeconds * 1000L);
}

@Override
Expand Down

0 comments on commit c96e896

Please sign in to comment.