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

156
LINES

< > BotCompany Repo | #1010768 // EagleDNS for botcompany.de [the real one, #1010768, but currently using domain provider's DNS]

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

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

!7

// NOTE: make sure the SOA is correct!

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

sS zone = [[
botcompany.de. IN    SOA   ns1.stefantrades.pro.  stefan\.reich\.maker\.of\.eye.gmail.com.  (
                                        20190925     ; Serial
                                        60M     ; Refresh
                                        15M     ; Retry
                                        7D      ; Expiry
                                        30M )   ; Minimum
@                       IN      NS      ns1.stefantrades.pro.
@                       IN      NS      ns2.stefantrades.pro.
@                       IN      A       167.86.121.181
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
*.coffee                IN      A       195.154.179.147
vnc-coffee              IN      A       195.154.179.147
transpile-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
cruddie                 IN      A       195.154.179.147
*.cruddie               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
; sometimes the * entry doesn't work? vnc.botcompany.de caused NXDOMAIN
*                       IN      A       167.86.121.181
vnc                     IN      A       167.86.121.181
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
tester                  IN      A       144.126.145.56
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   "aWAwa7cLpPcFoIylAqQn13tmNyfZ6H36GUt2dFyt-eM"
botcompany.de.          IN      TXT     "google-site-verification=YL5Hu5zvww8np30b4LLv_fgK0rppl2uzUKe8-14Gk98"
]];

// Note: zone2 not active yet

sS zone2 = [[
gazelle.rocks. IN    SOA   ns1.stefantrades.pro.  stefan\.reich\.maker\.of\.eye.gmail.com.  (
                                        20190101     ; Serial
                                        5M     ; Refresh
                                        15M     ; Retry
                                        7D      ; Expiry
                                        30M )   ; Minimum
@                       IN      NS      ns1.stefantrades.pro.
@                       IN      NS      ns2.stefantrades.pro.
@                       IN      A       173.212.209.120
*                       IN      A       173.212.209.120
;@                       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");
  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, r 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();
}

static void saveZones {
  S acmeChallenge = loadTextFileTrim(userFile("acme-challenge.txt")); // Note: not used anymore, just edit this source
  if (nempty(acmeChallenge))
    zone = jreplace(zone,
      "_acme-challenge.botcompany.de. IN TXT <quoted>",
      "_acme-challenge.botcompany.de. IN TXT " + quote(unnull(acmeChallenge)));
  print(zone);
  saveTextFile(newFile(zonesDir, "botcompany.de"), zone);
  saveTextFile(newFile(zonesDir, "gazelle.rocks"), zone2);
}

download  show line numbers  debug dex  old transpilations   

Relations

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

134 comment(s) hidden. show

Snippet ID: #1010768
Snippet name: EagleDNS for botcompany.de [the real one, #1010768, but currently using domain provider's DNS]
Eternal ID of this version: #1010768/187
Text MD5: 0247381ef2dcd6c7714ffc9fca6c6438
Transpilation MD5: 18b8e2153b81603e063593155ea04514
Author: stefan
Category: javax / dns
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2024-06-16 21:13:51
Source code size: 6393 bytes / 156 lines
Pitched / IR pitched: No / No
Views / Downloads: 4001 / 58126
Version history: 186 change(s)
Referenced in: [show references]