Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

72
LINES

< > BotCompany Repo | #1013646 // OLD EagleDNS for botcompany.de v1 [BotCompany.de only, works / requires root]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 2616K of libraries. Click here for Pure Java version (8064L/56K).

!7

static double refreshEvery = 60;
static int smartBotTimeOut = 60*5;

sS zone = [[
botcompany.de. IN    SOA   ai1.lol.  info.ai1.lol.  (
                                        20091118     ; Serial
                                        5M     ; Refresh
                                        2M     ; Retry
                                        5M     ; Expiry
                                        5M )   ; Minimum
@                       IN      NS      ai1.lol.
@                       IN      NS      tinybrain.de.
@                       IN      A       69.10.46.185
*                       IN      A       69.10.46.185
@                       MX      10      mail1.domainssaubillig.de.
]];

lib 1008223 // dnsjava
lib 1010766 // EagleDNS
lib 1004911 // log4j

import se.unlogic.eagledns.EagleDNS;

static File zonesDir;
static EagleDNS eagleDNS;

p {
  tryToAcquirePort5000();
  
  S conf = loadSnippet(#1010767);
  zonesDir = programFile("zones");
  saveZone();
  
  conf = conf.replace(
    [[<Property name="zoneFileDirectory">zones</Property>]],
    [[<Property name="zoneFileDirectory">]] + f2s(zonesDir) + [[</Property>]]);
  File configFile = saveProgramTextFile("config.xml", conf);
  
  //eagleDNS = nuObject("se.unlogic.eagledns.EagleDNS", f2s(configFile));
  eagleDNS = new EagleDNS(f2s(configFile));
  bot("Eagle DNS.");
  doEvery_daemon(refreshEvery, f refresh);
}

answer {
  if "test" ret "OK";
  if "refresh" {
    refresh();
    ret "OK";
  }
}

static void refresh() {
  saveZone();
  eagleDNS.reloadZones();
}

sS makeZone {
  S z = rtrim(zone);
  S ip = smartBotIP();
  if (ip != null) {
    z += "\nsmartbot-direct \*smartBotTimeOut*/      IN      A       " + ip;
    z += "\nsmartbot        \*smartBotTimeOut*/      IN      A       " + ip;
  }
  ret z;
}

static void saveZone {
  saveTextFile(newFile(zonesDir, "botcompany.de"), makeZone());
}

Author comment

Began life as a copy of #1010768

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013646
Snippet name: OLD EagleDNS for botcompany.de v1 [BotCompany.de only, works / requires root]
Eternal ID of this version: #1013646/2
Text MD5: d5d343b8833bc382440a0dc986f04352
Transpilation MD5: 943c6eaf001d0f6c63d4c45d9bf67842
Author: stefan
Category: javax / dns
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-18 01:24:42
Source code size: 1954 bytes / 72 lines
Pitched / IR pitched: No / No
Views / Downloads: 318 / 763
Version history: 1 change(s)
Referenced in: [show references]