Started by cynagen, Aug 19, 2018, 09:39 pm
API Usageos.loadAPI("dns") --DNS API requiredos.loadAPI("dnshook") --DNS RedNet hook library recommended (Mitchfizz05's original code, no changes here)dns.scan() -- Scans for DNS servers on the network. Returns the ID of the first DNS server, if found. If none found, returns nil.dns.lookup("hostname") -- Resolves the hostname to an ID (if possible, returns nil otherwise)dns.publish() -- Publishes the computer to the DNS servers on the network (returns true if successful, false otherwise)dns.unpublish() -- Unpublishes the computer from the DNS servers on the network (returns true if successful, false otherwise)Server UsageConfigure static hostname mappings using the file data/hosts, same format as Mitchfizz05, hostname:# once per line.NOTE: Configuring a static mapping on a DNS server will automatically make the server "authoritative" of that hostname. This record cannot be removed with dns.unpublish().The server has 2 additional options in the head of the script itself, they are as follows:allowZoneTransfers; Default: false, directs the server whether or not to honor Zone Transfer requestsonlyAuthZone; Default: true, directs the server whether to only share records it loaded itself and is authoritative of, or all current recordsLaunch however you choose, on-demand, as the startup script, or part of an automated startup script. Display will provide count and list of known hosts. If the hosts list becomes too long, it -will- overflow, known bug. I am looking at ways to address this and welcome feedback.
lua> os.loadAPI("dns")truelua> os.setComputerLabel("cynagen")lua> dns.lookup("cynagen")lua> dns.publish()truelua> dns.lookup("cynagen")3lua> dns.unpublish()truelua> dns.lookup("cynagen")