layer4-proxy/README.md

64 lines
1.6 KiB
Markdown
Raw Normal View History

# l4p
2021-10-21 08:43:59 +00:00
> Hey, now we are on level 4!
2021-10-21 08:43:59 +00:00
![CI](https://drone-ci.kiers.eu/api/badges/jjkiers/layer4-proxy/status.svg)
2021-10-25 14:29:02 +00:00
`l4p` 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.
2021-10-26 15:58:00 +00:00
## Features
2021-10-21 08:43:59 +00:00
- Listen on specific port and proxy to local or remote port
- SNI-based rule without terminating TLS connection
- DNS-based backend with periodic resolution
2021-10-21 08:43:59 +00:00
## Installation
2021-10-21 08:43:59 +00:00
To gain best performance on your computer's architecture, please consider build the source code. First, you may need [Rust tool chain](https://rustup.rs/).
2021-10-21 08:43:59 +00:00
```bash
$ cd l4p
2021-10-21 08:43:59 +00:00
$ cargo build --release
```
Binary file will be generated at `target/release/l4p`, or you can use `cargo install --path .` to install.
2021-10-21 08:43:59 +00:00
Or you can use Cargo to install `l4p`:
2021-10-26 13:40:40 +00:00
```bash
$ cargo install l4p
2021-10-26 13:40:40 +00:00
```
Or you can download binary file form the Release page.
2021-11-01 07:56:57 +00:00
## Configuration
2021-10-21 08:43:59 +00:00
`l4p` will read yaml format configuration file from `/etc/l4p/l4p.yaml`, and you can set custom path to environment variable `L4P_CONFIG`, here is an minimal viable example:
2021-10-21 08:43:59 +00:00
```yaml
version: 1
log: info
servers:
2021-10-26 13:36:12 +00:00
proxy_server:
2021-10-21 08:43:59 +00:00
listen:
- "127.0.0.1:8081"
default: remote
upstream:
remote: "tcp://www.remote.example.com:8082" # proxy to remote address
2021-10-21 08:43:59 +00:00
```
There are two upstreams built in:
* Ban, which terminates the connection immediately
* Echo, which reflects back with the input
2021-10-21 08:43:59 +00:00
For detailed configuration, check [this example](./config.yaml.example).
2021-10-21 08:43:59 +00:00
## Thanks
2021-10-26 15:02:05 +00:00
- [`l4p`](https://crates.io/crates/`l4p`), of which this is a heavily modified fork.
2021-10-26 15:02:05 +00:00
## License
2021-10-21 08:43:59 +00:00
`l4p` is available under terms of Apache-2.0.