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

177
LINES

< > BotCompany Repo | #1010768 - EagleDNS for botcompany.de [LIVE]

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

Uses 2616K of libraries. Click here for Pure Java version (11647L/77K).

!7

// TODO before July 2021: Register replacement for bothouse.de

static double refreshEvery = 0 /*60*/;
static int smartBotTimeOut = 60*30;

sS zone = [[
botcompany.de. IN    SOA   ns1.bothouse.de.  stefan\.reich\.maker\.of\.eye.gmail.com.  (
                                        20190925     ; Serial
                                        30M     ; Refresh
                                        1M      ; Retry
                                        7D      ; Expiry
                                        30M )   ; Minimum
@                       IN      NS      ns1.bothouse.de.
@                       IN      NS      ns2.bothouse.de.
@                       IN      A       167.86.121.181
gazelle                 IN      A       207.180.245.135
seven                   IN      A       207.180.245.135
fourg                   IN      A       164.68.97.209
new                     IN      A       164.68.97.209
bird                    IN      A       164.68.97.209
contabo2                IN      A       164.68.97.209
c8                      IN      A       167.86.121.181
home                300 IN      A       2.203.147.51
oldmain                 IN      A       185.183.156.46
coffee                  IN      A       195.154.179.147
avor                    IN      A       195.154.179.147
robin-avor              IN      A       195.154.179.147
christian-avor          IN      A       195.154.179.147
avor-qa                 IN      A       195.154.179.147
*.avor-qa               IN      A       195.154.179.147
stripe-test             IN      A       195.154.179.147
meta-bot                IN      A       195.154.179.147
ada-v2                  IN      A       195.154.179.147
fia                     IN      A       195.154.179.147
e-buck                  IN      A       195.154.179.147
ada-aws                 IN      A       18.233.63.26
code                    IN      A       167.86.121.181
www                     IN      A       167.86.121.181
butter                  IN      A       167.86.121.181
stefans-os              IN      A       167.86.121.181
smartbot                IN      A       167.86.121.181
create                  IN      A       167.86.121.181
mail                    IN      A       167.86.121.181
javax                   IN      A       167.86.121.181
ada                     IN      A       167.86.121.181
mech                    IN      A       167.86.121.181
theadmi                 IN      A       176.58.127.141
theadmi2                IN      A       176.58.127.141
gazellebot              IN      A       173.212.209.120
;pays5-bot               IN      A       173.212.209.120
pays5-bot               IN      A       195.154.179.147
bea-bot                 IN      A       173.212.209.120
tlc                     IN      A       195.154.179.147
big                     IN      A       192.99.13.227
;@                       MX      10      mail1.domainssaubillig.de.
@                       MX      10      mail.botcompany.de.
mail                    MX      10      mail.botcompany.de.
_acme-challenge.botcompany.de. IN      TXT     "-0Vm7D7a4NY_vwi9qcKxKiV2II6DHeP5i0ed0gsMtBM"
botcompany.de.          IN      TXT     "google-site-verification=YL5Hu5zvww8np30b4LLv_fgK0rppl2uzUKe8-14Gk98"
]];

// Note: agi.blue is now on NameCheap DNS (following zone is irrelevant)

sS zone2 = [[
agi.blue. IN    SOA   ns1.bothouse.de.  stefan\.reich\.maker\.of\.eye.gmail.com.  (
                                        20190101     ; Serial
                                        30M     ; Refresh
                                        1M      ; Retry
                                        7D      ; Expiry
                                        30M )   ; Minimum
@                       IN      NS      ns1.bothouse.de.
@                       IN      NS      ns2.bothouse.de.
@                       IN      A       167.86.121.181
*                       IN      A       167.86.121.181
@                       MX      10      mail1.domainssaubillig.de.
mail                    MX      10      mail.botcompany.de.
agi.blue                IN      TXT     "google-site-verification=oRvyeTqgSuv-FE_c-2UKM1Vp0oDqx8h9WruHYWqA-NQ"
_acme-challenge.agi.blue. IN      TXT     "5-eBkkE89wC9wtMXcS1xC60a2ZXlHvUcCoEX_b-s9bg"
]];

sS zone3 = [[
pays5.com. IN    SOA   ns1.bothouse.de.  stefan\.reich\.maker\.of\.eye.gmail.com.  (
                                        20190101     ; Serial
                                        30M     ; Refresh
                                        1M      ; Retry
                                        7D      ; Expiry
                                        30M )   ; Minimum
@                       IN      NS      ns1.bothouse.de.
@                       IN      NS      ns2.bothouse.de.
@                       IN      A       195.154.179.147
www                     IN      A       195.154.179.147
*                       IN      A       195.154.179.147
@                       MX      10      mail1.domainssaubillig.de.
_acme-challenge.pays5.com.             IN      TXT     ""
]];

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");
  saveZones();
  
  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));
  print("Making EagleDNS.");
  pcall {
    eagleDNS = new EagleDNS(f2s(configFile));
  }
  
  // For some weird reason, on the servers, no lines are printed
  // after this point... but they still execute!? (Auto-reload works.)
  
  printAndProgramLog("Made EagleDNS." + (eagleDNS == null ? "..not" : ""));
  bot("Eagle DNS.");
  if (refreshEvery != 0) doEvery_daemon(refreshEvery, f refresh);
  
  // Restart after successful transpile
  
  print("Making SnippetUpdateConnector.");
  ownResource(snippetUpdateConnector(verbose := true));
  
  ownResource(vmBus_onMessage snippetUpdate(voidfunc(L l) {
    print("Got snippet update: " + l);
    S uri = getString(l, 1);
    new Matches m;
    if (swic(uri, "/transpileOK/", m))
      if (sameSnippetID(programID(), firstIntAsString(m.rest()))) {
        programLog("Restarting");
        restart();
      }
  }));
}

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

static void refresh() {
  saveZones();
  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 saveZones {
  saveTextFile(newFile(zonesDir, "botcompany.de"), makeZone());
  saveTextFile(newFile(zonesDir, "agi.blue"), zone2);
  saveTextFile(newFile(zonesDir, "pays5.com"), zone3);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 21 computer(s): aoiabmzegqzx, bhatertpkbcr, bvpoyihotdib, cbybwowwnfue, cfunsshuasjs, fzcpzdstiiyc, gwrvuhgaqvyk, ishqpsrjomds, jozkyjcghlvl, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, ppjhyzlbdabe, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1010768
Snippet name: EagleDNS for botcompany.de [LIVE]
Eternal ID of this version: #1010768/143
Text MD5: ff02a6612047193d4e5eef4e80f6c599
Transpilation MD5: f25ff101d3787d0761c130e764bd26fb
Author: stefan
Category: javax / dns
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-04 23:48:06
Source code size: 7297 bytes / 177 lines
Pitched / IR pitched: No / No
Views / Downloads: 772 / 46461
Version history: 142 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1010768 & http://1010768.tinybrain.de