Skip to content

A mnhv1 protocol server which help mnh punch NAT hole. 一个使用mnhv1协议协助mnh打NAT洞的服务器

License

Notifications You must be signed in to change notification settings

hzyitc/mnh_server

Repository files navigation

mnh_server

GitHub release

README | 中文文档

Introduction

mnh_server is a server implement mnhv1 protocol.

mnhv1 is a protocol which help to punch nat hole.

Usage

Clone and build

> git clone https://github.com/hzyitc/mnh_server
> cd mnh_server
> make

Run mnh_server

> ./mnh_server <port>

Protocol Details

mnh_server will handle mnhv1 and HTTP protocol in same port.

All messages are text.

mnhv1

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:

.

HTTP

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.

About

A mnhv1 protocol server which help mnh punch NAT hole. 一个使用mnhv1协议协助mnh打NAT洞的服务器

Resources

License

Stars

Watchers

Forks