mnh_server
is a server implement mnhv1
protocol.
mnhv1
is a protocol which help to punch nat hole.
> git clone https://github.com/hzyitc/mnh_server
> cd mnh_server
> make
> ./mnh_server <port>
mnh_server
will handle mnhv1
and HTTP
protocol in same port.
All messages are text.
Client:
mnhv1 {id}\n
Server:
{ip}:{port}\n
Then,
Every 10s, client send a heartbeat to server:
heartbeat\n
Every time when server recieves a packet, it needs to send a heartbeat back:
.
Client:
GET /{id} {Don't care the following data}
Server:
HTTP/1.1 200 OK\r\n
Server: mnhv1\r\n
Content-Length: {len}\r\n
\r\n
{ip}:{port}
Then, server closes the connection.