Git Product home page Git Product logo

zt-tcp-relay's Introduction

ZeroTier TCP Relay

TCP fallback for ZeroTier nodes. Written for fun in Rust :)

TCP fallback

By default, ZeroTier node uses global-anycast-core-svc.zerotier.com. If you want to use your own server, you have to compile zerotier-one from source. Also, there was (until version 1.2.6) a tcp proxy server in the official repository, you can compile and run it.

+----+     +----+     +----+
| N1 |     | N2 |     | N3 |
+----+     +----+     +----+
  ^           ^          ^
  |           |          |
  --------    |   --------
         | UDP|   |
         v    v   v
        +-----------+
        | TCP proxy |
        +-----------+
              ^
              |   Firewall:
              |   TCP/443 only
--------------|---------------
              v
          +-------+
          |  you  |
          +-------+

This repository provides an alternative TCP proxy server.

How it works

In case when ZeroTier node can't become online using UDP protocol (for example if it's firewalled), it's trying to use a TCP relay as a fallback. It connects to a proxy server and sends specific packets imitating TLS frames:

[TSL frame header; ...; IP; Port; Data ...]

Proxy server parses the packets and sends them to recipients using UDP. When it receives answers, it sends them back to the client.

Packet structure

Docker

You can use the server in a Docker container:

docker run -d --name zt-tcp-relay -p 0.0.0.0:443:443 akhmetov/zerotier-tcp-relay

Build docker container:

docker build . -f Dockerfile -t zerotier-tcp-relay

Command line usage

Build the server and run:

cargo build --release

./target/release/zt-tcp-relay 0.0.0.0:443

You can specify logging level with RUST_LOG environment variable:

RUST_LOG=info cargo run

Log level debug is descreases performance and produces a lot of messages.

Development

Run tests

cargo test

zt-tcp-relay's People

Contributors

alexander-akhmetov avatar dependabot-preview[bot] avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.