A browser terminal that uses WebRTC to punch through NATs.
The frontend uses the amazing xterm.js.
This demo includes two tightly coupled applications and an optional signalling server:
stdin
and outputs data to
stdout
) accessible by using RAWRTC's data channel implementation. IO will
be relayed from/to the web terminal frontend.In the following sections, we will describe how to build the RAWRTC terminal backend followed by usage instructions for the combination of the two applications.
The following dependencies are required:
~~If you want to use Meson instead of CMake, you have to install both the Meson build system and Ninja.~~ Use CMake for now. Meson will be updated later.
The following instruction will use a custom prefix to avoid installing the necessary dependencies and this library system-wide.
Make sure you have set up the package configuration path to be able to find the RAWRTC library and its dependencies.
Will be added later. Use Cmake for now.
cd <rawrtc-terminal-demo>/c
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${PWD}/prefix ..
make install
Ensure you have set up the library path (LD_LIBRARY_PATH
environment variable) to be able to find the RAWRTC shared library and its
dependency libraries. In addition, update the PATH
environment variable
to find the newly built binary:
export PATH=${PWD}/prefix/bin:${PATH}
Note: We assume that you are in the build
directory.
Now you should be able to print usage information of the RAWRTC terminal application by invoking
rawrtc-terminal
which will output
Usage: rawrtc-terminal <0|1 (ice-role)> [<sctp-port>] [<shell>] [<ws-url>]
[<ice-candidate-type> ...]
Below is a description for the various arguments:
Determines the ICE role to be used by the ICE transport, where 0
means
controlled and 1
means controlling. For now, the web terminal will
always take the controlling role, thus you must use 0
for the RAWRTC
terminal application.
The port number the internal SCTP stack is supposed to use. Defaults to 5000
.
Note: It doesn't matter which port you choose unless you want to be able to debug SCTP messages. In this case, it's easier to distinguish the peers by their port numbers.
The binary the data channel's incoming messages will be piped into (stdin
) and
whose output (stdout
) will be sent over the data channel to the other peer.
Defaults to bash
.
If supplied and set to a valid WebSocket URI, the signalling server and the
WebSocket path supplied in the URI will be used to exchange signalling data.
The URI is split into three parts: ws://<hostname-or-ip>/<channel>/<ice-role>
0
to 1
and vice versa.If not supplied or not a valid WebSocket URI, the copy & paste mode will be used.
If supplied, one or more specific ICE candidate types will be enabled and all other ICE candidate types will be disabled. Can be one of the following strings:
Note that this has no effect on the gathering policy. The candidates will be gathered but they will simply be ignored by the tool.
If not supplied, all ICE candidate types are enabled.
Before we can go ahead, we need to choose between two modes:
ws-uri
argument description.Local Parameters:
from the RAWRTC terminal application into the web terminal. Copy the web
terminal's JSON blob into the RAWRTC terminal application. Press Enter
in the RAWRTC terminal application.