Skip to content

R0x7e/PortFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PortFlow

Go Version License Platform Build Status

English | 简体中文

A high-performance, production-grade TCP port forwarding tool written in Go.

Features

  • Bidirectional Forwarding: Supports any TCP-based protocols (HTTP, HTTPS, custom protocols).
  • High Concurrency: Based on goroutine pool, supports 10,000+ concurrent connections.
  • Security: Optional HTTP Basic Authentication (RFC 7617).
  • Performance:
    • Connection pooling for target servers.
    • Multi-layer timeout control (Connect, R/W, Idle).
    • Low latency (<1ms loopback).
  • Production Ready:
    • Graceful shutdown (SIGINT/SIGTERM).
    • Real-time performance metrics.
    • Comprehensive error handling.
    • Zero external dependencies.
  • Observability: Customizable log levels (Debug, Info, Warn, Error).

Installation

From Source

go build -o portflow ./cmd/portflow

Using Docker

docker build -t portflow .
docker run -p 8080:8080 portflow --listen-port 8080 --target-addr 1.2.3.4 --target-port 80

Usage

./portflow --listen-port <port> --target-addr <ip> --target-port <port> [options]

Options

  • --listen-addr: Local address to listen on (default: 0.0.0.0)
  • --listen-port: Local port to listen on (required)
  • --target-addr: Target server IP/domain (required)
  • --target-port: Target server port (required)
  • --auth: Enable HTTP Basic Authentication (default: false)
  • --user: Auth username
  • --pass: Auth password
  • --log-level: Log level (debug, info, warn, error) (default: info)
  • --conn-timeout: Connection timeout in seconds (default: 30)
  • --rw-timeout: Read/Write timeout in seconds (default: 60)
  • --idle-timeout: Idle connection timeout in seconds (default: 300)

Performance

Concurrency Throughput Latency Memory per k-conn
1,000 >100 MB/s <1 ms <1 MB
5,000 >100 MB/s <1 ms <1 MB
10,000 >100 MB/s <1 ms <1 MB

License

MIT

About

TCP port forwarding tool|TCP 端口转发工具

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors