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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

59a750d · Jun 7, 2021

History

2 Commits
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021
Jun 7, 2021

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