datalink_relay is a library written in go for the purpose of allowing servers behind a firewall to listen for connections on an untrusted relay server. The library exports the net.Listener and net.Dialer interfaces for convenience of use, for servers and clients.
- Relay starts listening for connection/listen requests
- Server registers a listen request with Relay and maintains persistent connection
- Client registers connect request at Relay and waits on request
- Relay forwards Client's connection request to Server over persistent connection
- Server dials back to Relay
- Relay completes connection and starts forwarding data
Note that in current implementation MTLS support is only enabled for connection at step 6, i.e. the connection request and persistent connection send messages in the clear over http
-
From the project root directory run:
go build -o bin/ ./...
-
The compiled executables will be in the bin/ directory
-
Now from 3 separate terminals run in order:
./relay ./server ./client
-
The client will echo single words back via the terminal
To run a basic demo in a single executable run ./all
. It runs all three entities at once and has a few clients print basic messages at the server. Instructions for the MTLS versions are similar. Note that all demos run on localhost with hardcoded values that can be found here.
Documentation of the public facing API can be found here.