Convert Figma logo to code with AI

zhaojh329 logortty

🐛 Access your terminal from anywhere via the web.

3,716
506
3,716
13

Top Related Projects

8,272

Share your terminal over the web

2,190

Share your terminal as a web application

14,052

A fast TCP/UDP tunnel over HTTP

24,203

Unified ingress for developers

17,914

The easiest, and most secure way to access and protect all of your infrastructure.

Quick Overview

rtty is a remote access tool for embedded Linux devices. It allows users to access their devices remotely through a web browser, providing terminal access and file management capabilities. The project aims to simplify remote management of IoT devices and embedded systems.

Pros

  • Secure communication using SSL/TLS encryption
  • Web-based interface for easy access without additional client software
  • Supports both terminal access and file management
  • Cross-platform compatibility (Linux, macOS, Windows)

Cons

  • Requires setup and configuration on both server and client sides
  • May have performance limitations on very low-resource devices
  • Documentation could be more comprehensive for advanced use cases
  • Limited community support compared to some larger remote access tools

Code Examples

// Initialize rtty with default options
struct rtty *rtty = rtty_new(NULL);
// Set custom options for rtty
struct rtty_options opts = {
    .device = "MyDevice",
    .token = "SecretToken123",
    .host = "example.com",
    .port = 5912
};
struct rtty *rtty = rtty_new(&opts);
// Start rtty session
int ret = rtty_start(rtty);
if (ret < 0) {
    fprintf(stderr, "Failed to start rtty: %s\n", strerror(-ret));
    return -1;
}

Getting Started

  1. Install rtty on your embedded device:

    opkg update
    opkg install rtty
    
  2. Configure rtty by editing /etc/config/rtty:

    config rtty
        option interface 'lan'
        option host 'your-server.com'
        option port '5912'
        option token 'your-secret-token'
    
  3. Start rtty service:

    /etc/init.d/rtty start
    
  4. Access your device through the web interface at https://your-server.com:5912

Competitor Comparisons

8,272

Share your terminal over the web

Pros of ttyd

  • More active development with frequent updates and contributions
  • Supports multiple authentication methods (Basic Auth, SSL/TLS)
  • Offers a wider range of customization options and command-line flags

Cons of ttyd

  • Larger codebase, potentially more complex to maintain
  • Higher system requirements due to additional features

Code Comparison

ttyd:

static void check_origin(struct lws *wsi) {
    int origin_len = lws_hdr_total_length(wsi, WSI_TOKEN_ORIGIN);
    char buf[origin_len + 1];
    memset(buf, 0, sizeof(buf));
    int len = lws_hdr_copy(wsi, buf, sizeof(buf), WSI_TOKEN_ORIGIN);
    if (len > 0) {
        // Origin validation logic
    }
}

rtty:

static void on_ws_receive(struct pty_session *session, void *data, size_t len)
{
    if (session->state == STATE_NORMAL) {
        write(session->pty, data, len);
    } else if (session->state == STATE_WAIT_PASSWD) {
        // Password handling logic
    }
}

Both projects aim to provide web-based terminal access, but ttyd offers more features and customization options at the cost of increased complexity. rtty focuses on simplicity and ease of use, making it potentially more suitable for resource-constrained environments or simpler use cases. The code snippets demonstrate different approaches to handling WebSocket connections and data processing, reflecting the projects' distinct design philosophies.

2,190

Share your terminal as a web application

Pros of GoTTY

  • Web-based terminal access without additional client software
  • Supports custom command execution and URL parameters
  • Easy to set up and use with minimal configuration

Cons of GoTTY

  • Less focus on security features compared to RTTY
  • Limited to terminal access, while RTTY offers file transfer capabilities
  • May have higher resource usage due to web-based nature

Code Comparison

RTTY (C):

static void on_ws_handshake_done(struct mg_connection *nc)
{
    struct session *s = (struct session *)nc->user_data;
    s->ws_handshake_done = true;
    ev_timer_stop(s->loop, &s->tmr);
}

GoTTY (Go):

func (server *Server) handleWS(w http.ResponseWriter, r *http.Request) {
    conn, err := server.upgrader.Upgrade(w, r, nil)
    if err != nil {
        log.Print("Failed to upgrade connection: " + err.Error())
        return
    }
    defer conn.Close()
}

Both projects aim to provide remote terminal access, but RTTY focuses on embedded systems and offers more security features, while GoTTY provides a simpler web-based solution. RTTY is written in C, making it more suitable for resource-constrained environments, while GoTTY is written in Go, offering easier deployment and cross-platform compatibility.

14,052

A fast TCP/UDP tunnel over HTTP

Pros of Chisel

  • More versatile, supporting various protocols (HTTP, SOCKS5, TCP) and tunneling options
  • Cross-platform support (Windows, macOS, Linux) with easy installation
  • Active development and larger community support

Cons of Chisel

  • More complex setup and configuration compared to RTTY
  • Requires both client and server components to be installed and configured
  • May have higher resource usage due to its broader feature set

Code Comparison

RTTY (server-side):

int rtty_start(struct rtty *rtty)
{
    ev_io_init(&rtty->ior, rtty_read_cb, rtty->sock.fd, EV_READ);
    ev_io_start(rtty->loop, &rtty->ior);
    return 0;
}

Chisel (server-side):

func (s *Server) Start() error {
    if s.listener != nil {
        return errors.New("server already running")
    }
    l, err := net.Listen("tcp", s.config.Host)
    if err != nil {
        return err
    }
    s.listener = l
    return s.run()
}

Both projects aim to provide remote access solutions, but Chisel offers a more comprehensive set of features for tunneling and proxying, while RTTY focuses primarily on remote terminal access. Chisel's flexibility comes at the cost of increased complexity, while RTTY provides a simpler, more focused solution for its specific use case.

24,203

Unified ingress for developers

Pros of ngrok

  • More widely adopted and battle-tested in production environments
  • Offers a user-friendly web interface for managing tunnels and inspecting traffic
  • Provides additional features like custom subdomains and TLS encryption

Cons of ngrok

  • Closed-source software with limited customization options
  • Requires a paid subscription for advanced features and higher usage limits
  • May have potential privacy concerns due to traffic routing through third-party servers

Code Comparison

rtty:

int rtty_start(struct rtty *rtty)
{
    ev_io_init(&rtty->ior, rtty_read_cb, rtty->sock.fd, EV_READ);
    ev_io_start(rtty->loop, &rtty->ior);
    return 0;
}

ngrok:

func (c *Tunnel) Start() error {
    c.Lock()
    defer c.Unlock()
    return c.start()
}

Summary

rtty is an open-source, lightweight remote terminal solution, while ngrok is a more feature-rich, closed-source tunneling service. rtty offers greater flexibility and customization but may require more setup and technical expertise. ngrok provides a more user-friendly experience with additional features but comes with potential privacy concerns and usage limitations. The choice between the two depends on specific project requirements, technical expertise, and privacy considerations.

17,914

The easiest, and most secure way to access and protect all of your infrastructure.

Pros of Teleport

  • More comprehensive security features, including SSO, RBAC, and audit logging
  • Supports multiple protocols (SSH, Kubernetes, databases, web apps)
  • Scalable for enterprise environments

Cons of Teleport

  • More complex setup and configuration
  • Higher resource requirements
  • Steeper learning curve for users and administrators

Code Comparison

Teleport (Go):

func (s *Server) Start() error {
    s.Lock()
    defer s.Unlock()
    if s.started {
        return trace.AlreadyExists("server is already started")
    }
    s.started = true
    go s.serve()
    return nil
}

RTTY (C):

static void on_client_close(struct lws *wsi)
{
    struct tty_client *client = lws_wsi_user(wsi);
    if (client) {
        LIST_REMOVE(client, list);
        free(client);
    }
}

Key Differences

  • Teleport is written in Go, while RTTY is written in C
  • Teleport offers a more feature-rich solution for secure access management
  • RTTY focuses specifically on remote terminal access over the web
  • Teleport has a larger codebase and community, with more frequent updates
  • RTTY is lighter-weight and easier to set up for simple remote terminal needs

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

rtty(中文)

This project is officially supported by GL.iNet.

license PRs Welcome Issue Welcome Release Version Build Status visitors

flowchart TB
s[rttys with public IP address]
u1["User(Web Browser)"] --> s
u2["User(Web Browser)"] --> s
u3["User(Web Browser)"] --> s
s --> c1["rtty(Linux Device)"]
s --> c2["rtty(Linux Device)"]
s --> c3["rtty(Linux Device)"]

It is composed of a client and a server. The client is written in pure C. The server is written in go language and the front-end is written in Vue.

You can access your device's terminal from anywhere via the web. Distinguish your different device by device ID.

rtty is very suitable for remote maintenance your or your company's thousands of Linux devices deployed around the world.

Features

  • The client is writen in C language, very small, suitable for embedded Linux
    • No SSL: rtty(32K) + libev(56K)
    • Support SSL: + libmbedtls(88K) + libmbedcrypto(241K) + libmbedx509(48k)
  • Execute command remotely in a batch of devices
  • SSL support: openssl, mbedtls, CyaSSl(wolfssl)
  • mTLS
  • Very convenient to upload and download files
  • Access different devices based on device ID
  • Support HTTP Proxy - Access your device's Web
  • Fully-featured terminal based on Xterm.js
  • Simple to deployment and easy to use

Who's using rtty

Dependencies of the Client side

Deploying the server side

How to install rtty

For Linux distribution

Install Dependencies

sudo apt install -y libev-dev libssl-dev      # Ubuntu, Debian
sudo pacman -S --noconfirm libev openssl      # ArchLinux
sudo yum install -y libev-devel openssl-devel # Centos

Clone the code of rtty

git clone --recursive https://github.com/zhaojh329/rtty.git

Build

cd rtty && mkdir build && cd build
cmake .. && make install

For Buildroot

Select rtty in menuconfig and compile it

Target packages  --->
    Shell and utilities  --->
        [*] rtty

For OpenWRT

For Other Embedded Linux Platform

Command-line Options

Usage: rtty [option]
    -I, --id=string          Set an ID for the device(Maximum 63 bytes, valid
                             character:letter, number, underline and short line)
    -h, --host=string        Server's host or ipaddr(Default is localhost)
    -p, --port=number        Server port(Default is 5912)
    -d, --description=string Add a description to the device(Maximum 126 bytes)
    -a                       Auto reconnect to the server
    -s                       SSL on
    -C, --cacert             CA certificate to verify peer against
    -x, --insecure           Allow insecure server connections when using SSL
    -c, --cert               Certificate file to use"
    -k, --key                Private key file to use"
    -D                       Run in the background
    -t, --token=string       Authorization token
    -f username              Skip a second login authentication. See man login(1) about the details
    -R                       Receive file
    -S file                  Send file
    -v, --verbose            verbose
    -V, --version            Show version
    --help                   Show usage

How to run rtty

Replace the following parameters with your own parameters

sudo rtty -I 'My-device-ID' -h 'your-server' -p 5912 -a -v -d 'My Device Description'

If your rttys is configured with mTLS enabled (device key and certificate required), add the following parameters(Replace the following with valid paths to your own)

-k /etc/ssl/private/abc.pem -c /etc/ssl/certs/abc.pem

You can generate them e.g. via openssl tool openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:secp521r1 -keyout /tmp/key.pem -out /tmp/cert.pem -days 18262 -nodes -subj "/C=CZ/O=Acme Inc./OU=ACME/CN=ACME-DEV-123"

If your rttys is configured with a token, add the following parameter(Replace the following token with your own)

-t 34762d07637276694b938d23f10d7164

Usage

Use your web browser to access your server: http://your-server-host:5913, then click the connection button

connect devices with no web login required(you need to configure the device white list on the server)

http://your-server-host:5913/connect/devid1

http://your-server-host:5913/connect/devid2

Transfer file

Transfer file from local to remote device

rtty -R

Transfer file from remote device to the local

rtty -S test.txt

Execute command remotely

Contributing

If you would like to help making rtty better, see the CONTRIBUTING.md file.