Go to file
Jacob Kiers 483c058105 Slightly better way of finding the config file
It now also looks in the current working directory.

Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-08-25 22:53:46 +02:00
.cargo Add build instructions 2023-08-23 19:29:29 +02:00
src Slightly better way of finding the config file 2023-08-25 22:53:46 +02:00
tests Add upstream scheme support 2021-10-31 19:21:32 +08:00
.drone.jsonnet Update rust and zig 2023-08-24 18:45:04 +02:00
.gitignore Update gitignore 2023-08-23 20:33:07 +02:00
Cargo.lock Version 0.1.6 2023-08-23 20:52:46 +02:00
Cargo.toml Version 0.1.6 2023-08-23 20:52:46 +02:00
config.yaml.example Add sample configuration file 2023-08-23 19:29:49 +02:00
example-config.yaml Add upstream scheme support 2021-10-31 19:21:32 +08:00
LICENSE First commit 2021-10-21 16:43:59 +08:00
README-ZH.md Make English readme the default 2023-08-23 20:45:42 +02:00
README.md Make English readme the default 2023-08-23 20:45:42 +02:00

Fourth

Hey, now we are on level 4!

CI

Under heavy development, version 0.1 may update frequently

Fourth is a layer 4 proxy implemented by Rust to listen on specific ports and transfer TCP/KCP data to remote addresses(only TCP) according to configuration.

Features

  • Listen on specific port and proxy to local or remote port
  • SNI-based rule without terminating TLS connection
  • Allow KCP inbound(warning: untested)

Installation

To gain best performance on your computer's architecture, please consider build the source code. First, you may need Rust tool chain.

$ cd fourth
$ cargo build --release

Binary file will be generated at target/release/fourth, or you can use cargo install --path . to install.

Or you can use Cargo to install Fourth:

$ cargo install fourth

Or you can download binary file form the Release page.

Configuration

Fourth will read yaml format configuration file from /etc/fourth/config.yaml, and you can set custom path to environment variable FOURTH_CONFIG, here is an minimal viable example:

version: 1
log: info

servers:
  proxy_server:
    listen:
      - "127.0.0.1:8081"
    default: remote

upstream:
  remote: "tcp://www.remote.example.com:8082" # proxy to remote address

Built-in two upstreams: ban(terminate connection immediately), echo. For detailed configuration, check this example.

Performance Benchmark

Tested on 4C2G server:

Use fourth to proxy to Nginx(QPS of direct connection: ~120000): ~70000 req/s (Command: wrk -t200 -c1000 -d120s --latency http://proxy-server:8081)

Use fourth to proxy to local iperf3: 8Gbps

Thanks

License

Fourth is available under terms of Apache-2.0.