Search the Community
Showing results for tags 'dns'.
Found 5 results
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!
Simple (forward) DNS with minimal Setup Server-client architectur. Every client register his address automatically at server. Server hold a table of registred clients. Clients can send requests to get a address of a registred client. Its possible to setup multiple dns Server with own binded hosts in same network. If host not binded them try to find antother random dns server automatically. startup order of hosts and server not important. Server/Client support some arguments at runtime dnsserver status / dnsclient status dnsserver restart / dnsclient restart dnsserver start / dnsclient start / dnsserver stop / dnsclient stop dnsserver print (printing all entrys) dnsserver drop (delete all entrys) Example for usind Lib local dns=require("dns") local networkaddress=dns.ns("Computername") -- with local cached entrys to reduce network traffic --or local networkaddress=dns.ns("Computername", true) -- witout local cache. forced request on server more secure Important editable Files /etc/dns.cfg Installationfiles (u need a internet card and oppm) pastebin get sBWERkg3 server.lua pastebin get sThmq5sr client.lua
net API - The most basic DNS system How this works: The DNS server constantly broadcasts out its information every 2 seconds on the specified port The client APIs have a function to search for the next DNS server (they wait for the above information) which then sets the table containing the information to net.foundServer Now the client APIs have the ability to call net.setDNS(net.foundServer.address) to lock to that DNS With that the client APIs can now register and delete their URLs on this DNS server Every other client who has that DNS server locked on too can look up your modem's address by calling net.resolve(url) [returns true/false and the message (either an error or the address)] Requirements: DNS server: A setup with color support (it logs stuff on the screen and uses colors for that too) Of course a wireless network card My multitasking API which should be saved as "oc_multitasking_api" At best: openOS (because it uses the keyboard and event api) Client: The api A wireless network card of course And maybe an idea on how you can make use of it At best: openOS (because it uses the event api) How to set it up: Build a server / computer for the DNS server (look at the requirements) Buld a computer for the client(s) (look at the requirements) Create a new program to use the API NOTE: At boot, the API doesn't have a DNS server registered, you NEED to register it using net.listenForDNS() or directly putting in an address local net = require("net") --This needs to be called for every program which uses the API, which is normal net.listenForDNS() --This wont stop until it gets a message from a DNS server net.setDNS(net.foundServer.address) --Set the locked DNS to the actual address of the found server Functions: listenForDNS() : Waits for a DNS server to broadcast it's information registerURL([STRING]): Registers an URL for your modem's address (Returns true/false with an (error-) message) removeURL([STRING]): Removes the given URL from the DNS if it's yours (Returns true/false with an (error-) message) setDNS([STRING]): Set the locked DNS' address to the given one getDNS(): Get the currently locked DNS' address (returns the address of the DNS server's modem) getPort(): Get the port which the API looks for messages from the DNS server setPort([NUMBER]): Set the port which the API looks for messages from the DNS server resolve([STRING]): Try to get the modem address of the given URL (Returns true/false with the address or an error message) getURL([STRING]): The reverse of the above function (Returns true/false with the URL or an error message) getAll(): Returns a table with every URL and the associated address on the DNS server (key = URL, value = address) Download: DNS server: Pastebin net API: Pastebin NOTE: The DNS server does currently not save the DNS list on reboot and it looks like it stops broadcasting when the computer stays on when closing the server / game.
DOMAIN NAME SYSTEM Yep. This one works much like real one - but it's a little simpler. Basic system setup/configuration/howto/whatever The most important part of every global DNS system are root-server. In real life there are 13 of these, but for Minecraft one server should be enough(ofc. you can have more root-servers). To be able to use DNS system the client must know at least one root server. Now let's say we want few domains in our system: example.org. sub.example.org. populardomain.org. Now we create example network of 3 servers, with addresses addr1, addr2, addr3 The first server will be root server, the second will operate .org. zone and last one .example.org. Now you may wonder what are these dots after addresses - They are 'zones'. So for example address 'sub.example.org.' requires asking 3 zones to get address. Going from back, the first zone is the 'root zone' and is stored on root server. Root zone knows .org. zone and asks it about sub.example, then .org. asks .example.org. about sub.example.org. In my implementation there are 2 types of fields: a - address ns - name server - address of other DNS server that may know more about zone it is contained in. If requested record could not be found on server, the user will be directed to 'nearest' name server that may know something more. This way we can configure our servers to contain following fields: server 1(addr1) - root server ZONE org. NS -> addr2 ZONE net. NS -> otheraddr server 2(addr2) ZONE org. ZONE populardomain.com. A -> addresstohost1 ZONE example.org NS -> addr3 server 3(addr3) ZONE org. ZONE example.org. A -> exampleaddr1 ZONE sub.example.org. A -> exampleaddr2 Do the thing in real minecraft life All steps require servers with OSes on HDD!! Server 3: Put some floppy to server(or small hdd) [Install dnsserver] # fddid chose drive and set label 'example' Do same thing with Server 2 and 1(root server), but set labels like 'org' and 'root', then Root server(Server 1): Put floppy/hdd labeled with 'org' or whatever # nsctl setfdd ns orgDriveLabel org Then on the .org server(Server 2) put example.org fdd/hdd # nsctl setfdd ns exampleOrgDriveLabel example.org # nsctl set a addresstohost1 populardomain.com And finally on the third server do: # nsctl set a exampleaddr1 example.org # nsctl set a exampleaddr2 sub.example.org After doing all that stuff on the client set the root dns using the fdd/hdd created earlier: # resvctl setroot fdd rootFddOrHddLabel Finally on the client you should be able to do: # resolv sub.example.org and see 'exampleaddr2' as a result (Of course you can design the network in any way you want, you may create any TLD's you want, you may use TLS's as any other domain, and you can store the whole system on one server) INSTALLATION(through MPT) Both: # pastebin run KaATrNkb # mpt ppa add m6koc Then, for servers: # mpt install dnsserver # reboot reboot is required to get server running Or clients: # mpt install dns API The 'dns' package provides super-simple API for resolving, in fact only one function, returning requested computer card address dns.resolv(hostname: string):string TODO's Check this post for mistakes Create cache'ing servers to speed-up things find better way of carrying addresses than fdd/hdds(Ideas?) Code? http://cc.nativehttp.org/web.html?ppa=m6koc
This is a file/dns server program I wrote. just run it to start hosting a dns server, launch it with an additional argument to show the debug. DNS/File server: http://pastebin.com/pxFY89UZ The next file is the networking API I wrote to deal with server communications, it has 6 functions; register(name, port): This will register the machine with a name on the dns server, all further communications can be sent to the server and will be routed automatically. send(receiverName, message, opt1, opt2): This will send a message to the server which will then route it to receiverName. getRepoList(): returns table This will get a list of all files saved to the server in the REPO folder, returns a table. pull(destinationName, filename): Pulls a file from the server. destinationName is the target computer so you can pull from any machine to any other on the network. push(filepath, filename, version, installDir) Pushes a file to the server, here's what happens. The server will make a new folder in REPO eg "c/REPO/filename" inside that folder it will create a file labelled latest.txt, this file stores the version number and installDir so the pull function knows where things need to be installed and which version to send. (I did this so I can put in dependencies later... or you can.) the file itself is saved as the version number. listen(targetMsg): returns up to 3 messages Listens on the network until it hears a message. targetMsg is optional, if blank then the first modem message will be returned. call example: msg, opt1, opt2 = listen() will return three variables. as targetMsg is blank it will return on the first modem message it hears. net API: http://pastebin.com/1JMKXGEp Here's a program that uses the API to easily push and pull files from the server. It takes up to 4 arguments. I call it repo. so calling: "repo list" will display a list of all files stored on the server. "repo pull filename" will pull filename from the server to this computer. "repo push filename filepath version installDir" will push a local file to the server and update the latest.txt with the new version and installDir. Repo program: http://pastebin.com/cgjUBeT3