Skip to content
MPUDP Tunnel (User space MultiPath UDP)
C Makefile Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
locale Internationalize mpclient Apr 19, 2016
.gitignore
LICENSE
Makefile Internationalization Apr 19, 2016
README.md Add mlvpn into SEE ALSO section Aug 29, 2016
README.zh_CN.md
buffer.h 增加客户端超时检测,当客户端一段时间没有收到服务器的包后,就认为连接断开 Aug 19, 2015
client.c Internationalize mpclient Apr 19, 2016
client.d
client.h
client.sample.conf 客户端可以使用配置文件指定远程主机 Jan 17, 2015
linklist.h
make-locale.sh Internationalization Apr 19, 2016
mptunnel.c Internationalization Apr 19, 2016
mptunnel.d 将已收到的包列表由链表改为红黑树,提高效率 Jan 20, 2015
mptunnel.h
mptunnel.pot
net.c Internationalization Apr 19, 2016
net.h
rbtree.c 基本完成服务端处理 Aug 29, 2014
rbtree.d 基本完成服务端处理 Aug 29, 2014
rbtree.h 基本完成服务端处理 Aug 29, 2014
server.c Internationalization Apr 19, 2016
server.d 基本完成服务端处理 Aug 29, 2014
server.h

README.md

mptunnel

MultiPath Tunnel (Simpified user space MPUDP)

中文说明点此

ABOUT

MultiPath Tunnel is a multipath UDP implementation in user space. Like MultiPath TCP, you can establish several connections from local to remote server.

MPTCP(MultiPath TCP) is a good idea to make network connection robust, but it only works on TCP. I was searching for MPUDP implementation but got nothing, so I write this tool.

CONCEPTION

                        .---- bridge server 1 ----.
                       /                            \
 Server A --- mpclient ------- bridge server 2 ------- mpserver --- Server B
                       \                            /
                        `---- bridge server 3 ----`

There are two server named Server A and Server B. The network connection between Server A and Server B is unstable (with high packet loss ratio). Thus, we like to establish an multipath tunnel between Server A and Server B, hoping the connection between Server A and Server B become more stable (decrease packet loss ratio).

mpclient is the client part of mptunnel, it could be run on ServerA. You must tell mpclient the information of bridge servers. Once mpclient is started, it open a local UDP port for listen, forward any packet to/from bridge servers.

mpserver is the server part of mptunnel, it could be run on ServerB. You must tell mpserver the information of Server B. Once mpserver is started, it will forward any packet to/from Server B.

Bridge servers is simple, it only forward packets from mpclient to mpserver, or packets from mpserver to mpclient. You can use nc or socat to deploy a bridge server.

EXAMPLE

I want to connection to my OpenVPN server, but the connection is unstable, packet loss ratio is high. The TCP throughput over the OpenVPN tunnel is very small due to high packet loss ratio. To increase TCP throughput (decrease packet loss ratio), I can run a MPUDP to OpenVPN server and establish OpenVPN connection on it.

OpenVPN is listen on UDP port 1194, I run mpserver on OpenVPN server like this:

mpserver 2000 127.0.0.1 1194

On local, run mpclient:

mpclient mpclient.conf

Below is the content of mpclient.conf

1.1.1.1 4000
bridge1.myhost.com 4000
bridge2.myhost.com 4000

1.1.1.1 is the IP of OpenVPN server. It's okay to use it as a bridge server.

On each bridge server, use socat to forward packet:

socat udp-listen:4000 udp4:1.1.1.1:2000

Bridge server will listen on UDP port 3001, forward any recieved packet to 1.1.1.1:2000, and vice versa.

Now I make OpenVPN client to connect localhost:3000 which mpclient listening on, then OpenVPN will establish an OpenVPN connection over MultiPath UDP tunnel.

BUGS

  • mptunnel add some control information into packets, including synchronous information. mpserver and mpclient must be start at the same time. If mpclient or mpserver terminated, you have to restart both mpserver and mpclient to reestablish the tunnel.

  • Currently you can only specify signle target host. Any one knows is there any C library of SOCKS5 proxy? I think making mpclient as a SOCKS proxy server will make it more easy to use.

  • mptunnel encrypt packets defaultly, but it will decrease the throughput. I do some tests on my PC with Athlon II P320 Processor, the actual throughput is 3Mbps while using three tunnels, after I disable encryption the throughput increase to 300Mbps. If you dont't like mptunnel to encrypt packets, set environment variable MPTUNNEL_ENCRYPT=0

DEPENDENCIES

To compile mptunnel, these libraries are required:

  • libev

SEE ALSO

mlvpn, A similar solution for multipath UDP.

You can’t perform that action at this time.