Sign inSign up

me2digital/tls-proxy-tunnel

By me2digital

•Updated about 2 years ago

`tls-proxy-tunnel` is a layer 4 proxy in Rust to listen and transfer TCP data via a HTTP Proxy.

Image
Networking
0

1.4K

me2digital/tls-proxy-tunnel repository overview

⁠tls-proxy-tunnel

Hey, now we are on level 4!

tls-proxy-tunnel is a layer 4 proxy implemented by Rust to listen on specific ports and transfer TCP data to remote addresses (only TCP) via a HTTP Proxy according to the configuration.

The repository can be found on github.com/git001/tls-proxy-tunnel⁠

⁠Features

  • Listen on specific port and proxy to local or remote port
  • SNI-based rule without terminating TLS connection
  • DNS-based backend with periodic resolution
  • Use Upstream HTTP proxy with via keyword
  • Offer simple HTTP/1.1 health check
  • Lookup environment variables with in ${...}
  • Limit client connection by server maxclients

⁠Configuration

tls-proxy-tunnel will read yaml format configuration file from /etc/tpt/tpt.yaml, and you can set custom path to environment variable tpt_CONFIG, here is an minimal viable example:

version: 1
log: info

via: &viaanchor
  target: www.test1.com
  headers:
    Host: www.test1.com
    Proxy-Authorization: Basic ${ENCODED_PW}
    Proxy-KeepAlive: true

servers:
  proxy_server:
    listen:
      - "127.0.0.1:8081"
    default: remote
    via:
      *viaanchor
  health-server:
    listen: [ "127.0.0.1:8081" ]
    default: health
    via:
      *viaanchor

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

There are two upstreams built in:

  • Ban, which terminates the connection immediately
  • Echo, which reflects back with the input
  • Health, a simple HTTP/1.1 health check

⁠Test run

TPT_CONFIG=container-files/etc/tpt/config.yaml cargo run

⁠Thanks

⁠License

tls-proxy-tunnel (tpt) is available under terms of Apache-2.0.

Tag summary

Content type

Image

Digest

sha256:4dd77fa54…

Size

274.9 MB

Last updated

about 2 years ago

docker pull me2digital/tls-proxy-tunnel:3.0