Search the Community
Showing results for tags 'dns'.
Found 1 result
About I recently made a simple DNS system and library for use with standard networking tools. It allows you to contact a server (that you know the address of) and look up other addresses by arbitrary names. For example. I want to make a server for something (eg a chat room) but I don't want people to have to tell their friends the really long address of my server for them to be able to connect. I can create a DNS at the DNS server and people can connect to something easier to remember than a UUID: eg. "mycoolchatroom" or "Codian's Chatroom". Requirements A Network Card is required for both the server and the library. It does not have to be wireless, though it is strongly recommended. An Internet Card is required for installation via pastebin. Installation - I want to host a server: Run the following command to download the DNS Server into your current working directory. pastebin get U9ZSdG77 dnsserver.lua To configure it, edit the file and change the variables as needed. Append any DNS addresses you want to the table "dnsdb". (The file is commented to make it easier to find.) Installation - I want to install the library to use with my programs: Run the following command to download the DNS Server into /lib/ and allow importing via require() pastebin get WqXQFchC /lib/dns.lua After you do this, you can import the DNS libary in your code. Here is an example program: local dns = require('dns') -- import the libary dns.setAddress('4d2e4c6c-b70b-42b0-85db-d3ea1b27b3c0') -- sets the DNS server address dns.setPort(42069) -- sets the DNS server port, the default is 42069 reply = dns.lookup('tutorial') -- look up a dns, in this case "tutorial" points to some address -- will return nil if there is no address corresponding to that dns -- will return false if the DNS server could not be reached -- will return string that contains the address for that DNS if everything went right if reply == nil then print("Couldn't find that address.") elseif reply == false then print("Couldn't connect to DNS server.") else print("DNS Found! " .. reply) end Hope you like it!