Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Protocols/dns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# DNS

## Quick Information

| Information | |
| ----------- | -------------------------------------------------------------- |
| Version | 1.0.0 |
| Type | Protocol |

## Technical Details

DNS defines a method of looking up hostnames in the context of protocols.

Any computer can broadcast a `lookup` for a hostname/protocol pair and will receive a `lookup response` from computers who identify themselves with the corresponding hostname/protocol pair.

Because it's not just hostnames but hostname/protocol pairs, there can be several computers using the same hostname for serving different protocols.

A computer can identify himself with every hostname/protocol pair he wants and with as many hostname/protocol pairs as he wants, as long as there are no duplicated hostname/protocol pairs in the world. The computer HAS TO lookup a hostname/protocol pair before identifying with it, if it is taken, the computer is NOT ALLOWED to identify with it.

Packets are composed of 3 strings:
* the package type
* the hostname
* the protocol

These strings are combined in a table:

```
{
sType = "<package type>"
sHostname = "<hostname>"
sProtocol = "<protocol>"
}
```

### Looking up a hostname/protocol pair

* The uplooking computer broadcasts a package of type `lookup`, where the hostname and protocol string are the hostname/protocol pair to look up.
* If a computer identifies himself with that hostname/protocol pair, it responds directly to the uplooking computer with a package of type `lookup response`, where the hostname and protocol strings are the hostname/protocol pair, the responding computer identifies himself with.

## Aviable APIs
* [Rednet API](http://www.computercraft.info/wiki/Rednet_(API)) from CC 1.6 onward