All Projects → HirbodBehnam → PortForwarder

HirbodBehnam / PortForwarder

Licence: MIT license
A small program to forward TCP traffic with QoS options

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to PortForwarder

Gobetween
☁️ Modern & minimalistic load balancer for the Сloud era
Stars: ✭ 1,631 (+5336.67%)
Mutual labels:  tcp, tcp-proxy
Goproxy
🔥 Proxy is a high performance HTTP(S) proxies, SOCKS5 proxies,WEBSOCKET, TCP, UDP proxy server implemented by golang. Now, it supports chain-style proxies,nat forwarding in different lan,TCP/UDP port forwarding, SSH forwarding.Proxy是golang实现的高性能http,https,websocket,tcp,socks5代理服务器,支持内网穿透,链式代理,通讯加密,智能HTTP,SOCKS5代理,黑白名单,限速,限流量,限连接数,跨平台,KCP支持,认证API。
Stars: ✭ 11,334 (+37680%)
Mutual labels:  tcp, tcp-proxy
dperf
dperf is a DPDK based 100Gbps network performance and load testing software.
Stars: ✭ 1,320 (+4300%)
Mutual labels:  tcp
QTcpSocket
A simple Qt client-server TCP architecture to transfer data between peers
Stars: ✭ 62 (+106.67%)
Mutual labels:  tcp
tcp server client
A thin and simple C++ TCP client server
Stars: ✭ 124 (+313.33%)
Mutual labels:  tcp
fourinarow-app
An online version of the popular game four in a row, written in Flutter + Dart on the client and Rust on the server side.
Stars: ✭ 23 (-23.33%)
Mutual labels:  tcp
snow
A small, fast, cross-platform, async Zig networking framework built on top of lithdew/pike.
Stars: ✭ 30 (+0%)
Mutual labels:  tcp
p2p
Simple implementation of a p2p network in Go
Stars: ✭ 12 (-60%)
Mutual labels:  tcp
ultrasonicnetworking
Ultrasonic networking - Transmitting TCP/IP via Ultrasound
Stars: ✭ 107 (+256.67%)
Mutual labels:  tcp
protocol
Easy protocol definitions in Rust
Stars: ✭ 151 (+403.33%)
Mutual labels:  tcp
performance
Collection of documents related tunings for performance of Java low-latency trading systems: from hardware up to application level
Stars: ✭ 65 (+116.67%)
Mutual labels:  tcp
Swiddler
TCP/UDP debugging tool.
Stars: ✭ 56 (+86.67%)
Mutual labels:  tcp
gnb udp over tcp
gnb_udp_over_tcp 是一个为GNB开发的通过tcp链路中转UDP分组转发的服务
Stars: ✭ 32 (+6.67%)
Mutual labels:  tcp
ronin-support
A support library for Ronin. Like activesupport, but for hacking!
Stars: ✭ 23 (-23.33%)
Mutual labels:  tcp
condor
A minimal library for building scalable TCP servers in Erlang
Stars: ✭ 75 (+150%)
Mutual labels:  tcp
DDoS-Script
A script written in perl for ddos ​​with automatic detection of open and vulnerable port that gives up to 1.5 gb packages / s
Stars: ✭ 30 (+0%)
Mutual labels:  tcp
mongoose
Embedded Web Server
Stars: ✭ 8,968 (+29793.33%)
Mutual labels:  tcp
GenericProtocol
⚡️ A fast TCP event based buffered server/client protocol for transferring data over the (inter)net in .NET 🌐
Stars: ✭ 38 (+26.67%)
Mutual labels:  tcp
ptw
Pooling TLS Wrapper
Stars: ✭ 20 (-33.33%)
Mutual labels:  tcp-proxy
masscanned
Let's be scanned. A low-interaction honeypot focused on network scanners and bots. It integrates very well with IVRE to build a self-hosted alternative to GreyNoise.
Stars: ✭ 50 (+66.67%)
Mutual labels:  tcp

Port Forwarder

A small program to port forward with quota options

What is this?

This a small program to forward ports with a quota option to control the data users use. Some features of this code are:

  • Lightweight: It has no dependencies, just the main file, and standard library.
  • Easy to use: Just edit the rules file, and you can use the proxy
  • High performance: With iperf3 I achieved 14.9 Gbits/sec in a local tunnel.
  • Simultaneous Connections Limit: Limit the amount of simultaneous connections that a port can have.
  • Soft Blocking: Block the new incoming connections and keep the old ones alive when the quota reaches. Read More

Install

Just head to releases and download one for your os.

Build from source

Building this is not that hard. At first install golang for your operating system. Clone this repository and run this command:

go build

The executable file will be available at the present directory.

How to use it?

Did you download the executable for your os? Good!

Edit the rules.json file as you wish. Here is the cheatsheet for it:

  • SaveDuration: The program writes the quotas to disk every SaveDuration seconds. Default is 600 seconds or 10 minutes.
  • Timeout: The time in seconds that a connection can stay alive without transmitting any data. Default is disabled. Use 0 to disable the timeout.
  • Rules Array: Each element represents a forwarding rule and quota for it.
    • Name: Just a name for this rule. It does not have any effect on the application.
    • Listen: The local port to accept the incoming connections for proxy.
    • Forward: The address that the traffic must be forwarded to. Enter it like ip:port
    • Quota: The number of bytes the user can transfer.
    • Simultaneous: Amount of allowed simultaneous connections to this port. Use 0, or remove it for unlimited.
    • ExpireDate: When this rule must expire? In unix epoch, UTC. You can use this site to convert date to unix epoch.

Save the file and just open the main executable to run the proxy.

Unlimited Quota

Well, you can't but actually you can!

The max quota value is 92233720368547758087. You can use this.

Arguments

There are two options:

  1. -h: It prints out the help of the proxy.
  2. --no-exit-save: Disable the before exit rules saving
  3. --verbose: Verbose mode (a number between 0 and 4)
  4. --config: In case you want to use a config file with another name, just pass it to program as the first argument. For example:
./PortForwarder --config custom_conf.json

Verbose modes

You have 5 options

0 means that the applications is mostly silent and prints fatal errors.

1 means regular errors and infos are shown. (This is the default value)

2 means it also prints when a user hits connection limit

3 means it also prints a log when a connection timeouts

4 means it prints every log possible. Use this to debug

Example:

./PortForwarder --verbose 2

How it works?

The base code is this(Thanks man!). The code is changed in order to measure the traffic transmitted.

Soft Blocking

So here is a part you should read. The proxy uses the io.Copy function(reference) in order to write the buffers. The good point is that the buffer is not with me, and it is with the golang itself and there is no loop. But there is a catch: This function returns when it reaches the EOF or in case of an error.

So what's wrong with this? Well, I can understand how many bytes had been transferred when the function returns. So here comes soft connections and fast-forward in cost of inaccuracy.

As soon as the function returns, the quota will change.

And what do I mean about the softer connections? The client can use the program after the quota is reached. When the client wants to establish a new connection it will be rejected from the server. Plus you can manage how much client has used more than its quota.

Other Stuff

Persian guild to setup this with mtproto

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].