rterm

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2024 License: MIT Imports: 17 Imported by: 0

README

GoDoc Go Report Card License

RTERM

RTERM is a web-based remote control application that allows you to control your terminal remotely.

Inspired by GoTTY

Installation

  1. Import as package to existing project.

    go get github.com/dev6699/rterm
    
    import (
        "github.com/dev6699/rterm"
        "github.com/dev6699/rterm/command"
    )
    
    func main() {
        rterm.SetPrefix("/")
        mux := http.NewServeMux()
    
        rterm.Register(
            mux,
            rterm.Command{
                Name:        "bash",
                Description: "Bash (Unix shell)",
                Writable:    true,
                AuthCheck:   auth.NewBasic("123456"),
            },
        )
    
        addr := ":5000"
        server := &http.Server{
            Addr:    addr,
            Handler: mux,
        }
        server.ListenAndServe()
    }
    

    Please check example for more information.

  2. Prebuilt binary.

    • Grab the latest binary from the releases page.
  3. From sources:

    # Clone the Repository
    git clone https://github.com/dev6699/rterm.git
    cd rterm
    
    # Build
    make build
    

Usage

  1. Start the binary ./rterm.
  2. Open web browser and navigate to http://<remote_ip>:5000.
  3. Get control of your terminal!

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(mux *http.ServeMux, commands ...Command)

Register binds all command handlers to the http mux. GET <prefix>/ -> commands listing index page. GET <prefix>/{command} -> command page. GET <prefix>/{command}/ws -> websocket for command inputs handling.

func SetPrefix

func SetPrefix(prefix string)

SetPrefix to override default url prefix

func SetWSUpgrader

func SetWSUpgrader(u websocket.Upgrader)

SetWSUpgrader to override default websocket upgrader

Types

type Command

type Command struct {
	// Name of the command, will be used as the url to execute the command
	Name string
	// Args of the the command
	Args []string
	// Description of the command
	Description string
	// Writable indicate whether server should process inputs from clients
	Writable bool
	// AuthCheck acts as pre-verification step before starts agent process
	AuthCheck auth.AuthCheck
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL