• Stars
    star
    572
  • Rank 75,030 (Top 2 %)
  • Language
    C++
  • License
    MIT License
  • Created over 6 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Lightweight Port Mapping/Forwarding Utility using epoll/libev, supports IPv4 and IPv6 for both TCP and UDP

tinyPortMapper (or tinyPortForwarder)

A Lightweight High-Performance Port Mapping/Forwarding Utility using epoll, Supports both TCP and UDP

Supported Platforms

Linux host (including desktop Linux,Android phone/tablet, OpenWRT router, or Raspberry PI). Binaries of amd64 x86 mips_be mips_le arm are provided.

Getting Started

Installing

Download binary release from https://github.com/wangyu-/tinyPortMapper/releases

Running

Assume you want to map/forward local port 1234 to 10.222.2.1:443

# for both TCP and UDP
./tinymapper_amd64 -l0.0.0.0:1234 -r10.222.2.1:443 -t -u

# for TCP only
./tinymapper_amd64 -l0.0.0.0:1234 -r10.222.2.1:443 -t

# for UDP only
./tinymapper_amd64 -l0.0.0.0:1234 -r10.222.2.1:443 -u

# for ipv6, both TCP and UDP
# ipv6 address must be surrounded with `[]`, ipv4 address must NOT be surrounded with `[]`
./tinymapper_amd64 -l[::]:1234 -r[2001:19f0:7001:1111:00:ff:11:22]:443 -t -u
NOTE
# local port and remote port can be the same
./tinymapper_amd64 -l0.0.0.0:443 -r10.222.2.1:443 -u

# you can also use 6-to-4 or 4-to-6 forward
./tinymapper_amd64 -l0.0.0.0:1234 -r[2001:19f0:7001:1111:00:ff:11:22]:443 -t -u
./tinymapper_amd64 -l[::]:1234 -r44.55.66.77:443 -t -u

# you can also use ipv4-mapped ipv6 address
# this is especially useful if you want to play with ipv6 and you dont have a real ipv6 address
./tinymapper_amd64 -l[::]:4433 -r[::ffff:10.222.2.1]:443 -t -u
./tinymapper_amd64 -l[::ffff:0.0.0.0]:4433 -r[::ffff:10.222.2.1]:443 -t -u

Options

tinyPortMapper
git version:25ea4ec047    build date:Nov  4 2017 22:55:23
repository: https://github.com/wangyu-/tinyPortMapper

usage:
    ./this_program  -l <listen_ip>:<listen_port> -r <remote_ip>:<remote_port>  [options]

main options:
    -t                                    enable TCP forwarding/mapping
    -u                                    enable UDP forwarding/mapping

other options:
    --sock-buf            <number>        buf size for socket, >=10 and <=10240, unit: kbyte, default: 1024
    --log-level           <number>        0: never    1: fatal   2: error   3: warn
                                          4: info (default)      5: debug   6: trace
    --log-position                        enable file name, function name, line number in log
    --disable-color                       disable log color
    -h,--help                             print this help message

Peformance Test

root@debian9:~# iperf3 -c 127.0.0.1 -p5202
Connecting to host 127.0.0.1, port 5202
[  4] local 127.0.0.1 port 37604 connected to 127.0.0.1 port 5202
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec   696 MBytes  5.84 Gbits/sec    0    639 KBytes
[  4]   1.00-2.00   sec   854 MBytes  7.17 Gbits/sec    0    639 KBytes
[  4]   2.00-3.00   sec   727 MBytes  6.10 Gbits/sec    0    639 KBytes
[  4]   3.00-4.00   sec   670 MBytes  5.62 Gbits/sec    0    639 KBytes
[  4]   4.00-5.00   sec   644 MBytes  5.40 Gbits/sec    0    639 KBytes
[  4]   5.00-6.00   sec   957 MBytes  8.03 Gbits/sec    0    639 KBytes
[  4]   6.00-7.00   sec   738 MBytes  6.19 Gbits/sec    0    639 KBytes
[  4]   7.00-8.00   sec   714 MBytes  5.99 Gbits/sec    0    639 KBytes
[  4]   8.00-9.00   sec   817 MBytes  6.85 Gbits/sec    0    639 KBytes
[  4]   9.00-10.00  sec   619 MBytes  5.19 Gbits/sec    0    639 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  7.26 GBytes  6.24 Gbits/sec    0             sender
[  4]   0.00-10.00  sec  7.26 GBytes  6.24 Gbits/sec                  receiver

Details and more test results at:

https://github.com/wangyu-/tinyPortMapper/wiki/Performance-Test

More Repositories

1

udp2raw

A Tunnel which Turns UDP Traffic into Encrypted UDP/FakeTCP/ICMP Traffic by using Raw Socket,helps you Bypass UDP FireWalls(or Unstable UDP Environment)
C++
6,851
star
2

UDPspeeder

A Tunnel which Improves your Network Quality on a High-latency Lossy Link by using Forward Error Correction, possible for All Traffics(TCP/UDP/ICMP)
C++
4,484
star
3

tinyfecVPN

A VPN Designed for Lossy Links, with Build-in Forward Error Correction(FEC) Support. Improves your Network Quality on a High-latency Lossy Link.
C++
2,196
star
4

udp2raw-multiplatform

multi-platform(cross-platform) version of udp2raw-tunnel, which supports Windows/Mac/BSD natively. Client-Only at the moment.
602
star
5

UDPping

ping with UDP packets 🛠
Python
268
star
6

canon_mc-g02_resetter

Use Arduino to reset the chip inside your Canon printer's MC-G02 Maintenance Cartridge, reuse it almost forever.
C++
35
star
7

mycc

A tiny C compiler of 2k lines of codes, generates pure x86 asm code for DOS/Win32/Linux 3 backends.
C++
26
star
8

kmod-my-nat

implement snat and dnat by yourself by using netfilter hook
C
14
star
9

tiny-encrypted-udp-tunnel

tiny-singlefile-encrypted-udp-tunnel
C++
12
star
10

info_sec

信息安全实验
C
8
star
11

alg_exp

算法课实验
C++
5
star
12

rockbox-modified

rockbox special modified version for SSDed Ipod Classic
C
4
star
13

pwdgen

password generator, for personal use
C++
4
star
14

GVmakerAD-ScrKey

GVmakerAD-ScrKey, lava interpreter written by eastsun.
Java
4
star
15

membench

a very elementry memory bench program
C
4
star
16

ios-codes

for personal use
Shell
3
star
17

soft-renderer

A software 3D model renderer of 2k lines of code, with ray tracing and phong shading support.
C++
3
star
18

crypto_lab

crypto_lab
C++
2
star
19

files

a repo for misc files and pages
C++
2
star
20

wireshark-manuf

hold a copy of wireshark manuf since the original link is 404
2
star
21

easy_od

an easy implementation of optimized distance of binary code
MATLAB
2
star
22

wind

文曲星游戏《风斗》lava移植版源码 (很久以前的代码)
2
star
23

wangyu-

2
star
24

usaco_solutions

usaco solutions
C++
1
star
25

mlsys20_workshop

C++
1
star
26

tunnels

some tunnels
C++
1
star
27

energy_aware_dnn

Roff
1
star
28

CobuildConv

based on http://hp.vector.co.jp/authors/VA005784/cobuild/cobuildconv.html
Ruby
1
star
29

SWRR-dict

a dict plugin for chrome
HTML
1
star
30

websec

websec codes, only used for personal backup
PHP
1
star