wrote some more docs

This commit is contained in:
Izaya 2018-04-06 16:42:03 +10:00
parent 6d3e20c91d
commit 57345b6598
2 changed files with 59 additions and 0 deletions

View File

@ -4,6 +4,8 @@ vTunnel can be used to add bridging over the internet to any existing OpenOS sof
Despite originally being written for Minitel, vTunnel implements a fully-functional linked card emulator and a server that will run under most unix-likes (OpenBSD is currently somewhat flaky, Linux is recommended).
The protocol is documented [here](vtunnel-protocol.md)
## Setup
### Server

View File

@ -0,0 +1,57 @@
# vTunnel - Protocol
vTunnel uses a (relatively) simple protocol to communicate over TCP, encoding packets as strings and adding a tag. The protocol is as follows:
```
<2 bytes length of packet><1 byte number of segments><2 bytes length of segment><1 byte type><data>
```
2-byte lengths are encoded as big-endian, as in the following code from interminitel.lua:
```
function imt.to16bn(n)
return string.char(math.floor(n/256))..string.char(math.floor(n%256))
end
```
Each packet can have up to 255 segments, or indeed zero.
So, to encode a packet with the field "Hello, world!":
```
0 \0
17 \17 first two bytes are length
1 \1 third is number of segments
0 \0
13 \13 length of first segment
1 \1 type of first segment (string)
72 H data from here
101 e
108 l
108 l
111 o
44 ,
32
119 w
111 o
114 r
108 l
100 d
33 !
```
## Types
1. string
2. number
3. boolean
4. nil
## Defaults
By default, the bridge server:
- uses port 4096, as Minitel does on OpenComputers networks
- drops clients after 60 seconds of inactivity
This can be configured by **FIXME.**