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).

1  
!7
2  
3  
static double refreshEvery = 60;
4  
static int smartBotTimeOut = 60*5;
5  
6  
sS zone = [[
7  
botcompany.de. IN    SOA   ai1.lol.  info.ai1.lol.  (
8  
                                        20091118     ; Serial
9  
                                        5M     ; Refresh
10  
                                        2M     ; Retry
11  
                                        5M     ; Expiry
12  
                                        5M )   ; Minimum
13  
@                       IN      NS      ai1.lol.
14  
@                       IN      NS      tinybrain.de.
15  
@                       IN      A       69.10.46.185
16  
*                       IN      A       69.10.46.185
17  
@                       MX      10      mail1.domainssaubillig.de.
18  
]];
19  
20  
lib 1008223 // dnsjava
21  
lib 1010766 // EagleDNS
22  
lib 1004911 // log4j
23  
24  
import se.unlogic.eagledns.EagleDNS;
25  
26  
static File zonesDir;
27  
static EagleDNS eagleDNS;
28  
29  
p {
30  
  tryToAcquirePort5000();
31  
  
32  
  S conf = loadSnippet(#1010767);
33  
  zonesDir = programFile("zones");
34  
  saveZone();
35  
  
36  
  conf = conf.replace(
37  
    [[<Property name="zoneFileDirectory">zones</Property>]],
38  
    [[<Property name="zoneFileDirectory">]] + f2s(zonesDir) + [[</Property>]]);
39  
  File configFile = saveProgramTextFile("config.xml", conf);
40  
  
41  
  //eagleDNS = nuObject("se.unlogic.eagledns.EagleDNS", f2s(configFile));
42  
  eagleDNS = new EagleDNS(f2s(configFile));
43  
  bot("Eagle DNS.");
44  
  doEvery_daemon(refreshEvery, f refresh);
45  
}
46  
47  
answer {
48  
  if "test" ret "OK";
49  
  if "refresh" {
50  
    refresh();
51  
    ret "OK";
52  
  }
53  
}
54  
55  
static void refresh() {
56  
  saveZone();
57  
  eagleDNS.reloadZones();
58  
}
59  
60  
sS makeZone {
61  
  S z = rtrim(zone);
62  
  S ip = smartBotIP();
63  
  if (ip != null) {
64  
    z += "\nsmartbot-direct \*smartBotTimeOut*/      IN      A       " + ip;
65  
    z += "\nsmartbot        \*smartBotTimeOut*/      IN      A       " + ip;
66  
  }
67  
  ret z;
68  
}
69  
70  
static void saveZone {
71  
  saveTextFile(newFile(zonesDir, "botcompany.de"), makeZone());
72  
}

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: 327 / 775
Version history: 1 change(s)
Referenced in: [show references]