ttyc

package module
v0.0.0-...-9f65fc3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

README

ttyc

Command-line client for ttyd, Wi-Se and anything else that uses a compatible protocol.

Features:

  • Works on all major operating systems including Windows
  • Built-in terminal with a user interface similar to that of tio
  • Supports configuring remote UART parameters for Wi-Se

Additionally, on all platforms except Windows and macOS:

  • Can expose the remote terminal as a pseudo-terminal, which you can connect to with any TTY program (screen, minicom, etc.)

wistty

Wistty is a utility to set remote terminal parameters for Wi-Se.

Wistty is not compatible with ttyd.

Installation

Releases

Head over to the Releases page and grab a prebuilt binary.

Arch Linux

Packages are available in the AUR:

Building

Quick way
go get github.com/Depau/ttyc/cmd/ttyc
go get github.com/Depau/ttyc/cmd/wistty

Binaries will be saved to $GOHOME/bin/ttyc and $GOHOME/bin/wistty, usually ~/go/bin/...

From local sources
git clone https://github.com/Depau/ttyc.git
cd ttyc/cmd/ttyc
go build
cd ../wistty
go build
Build locally for all platforms
git clone https://github.com/Depau/ttyc.git
cd ttyc
go run .ci/ci_build.go

Outputs will be placed in the build/ directory.

Usage

ttyc --url http://localhost:7681
  -h, --help                Show help
  -U, --url                 Server URL
  -w, --watchdog[=2]        WebSocket ping interval in seconds, 0 to disable, default 2.
  -r, --reconnect[=2]       Reconnection interval in seconds, -1 to disable, default 3.
      --backoff[=none]      Backoff type, none, linear, exponential, defaults to linear
      --backoff-value[=2]   For linear backoff, increase reconnect interval by this amount of seconds after each iteration. For exponential backoff, multiply reconnect interval by this amount. Default 2
  -u, --user                Username for authentication
  -k, --pass                Password for authentication
  -T, --tty                 Do not launch terminal, create terminal device at given location (i.e. /tmp/ttyd)
  -b, --baudrate[=-1]       (Wi-Se only) Set remote baud rate [bps]
  -p, --parity              (Wi-Se only) Set remote parity [odd|even|none]
  -d, --databits[=-1]       (Wi-Se only) Set remote data bits [5|6|7|8]
  -s, --stopbits[=-1]       (Wi-Se only) Set remote stop bits [1|2]
  -v, --version             Show version
wistty (ttyc) - Manage Wi-Se remote terminal parameters

Options:

  -h, --help            Show help
  -U, --url             Server URL
  -u, --user            Username for authentication
  -k, --pass            Password for authentication
  -j, --json            Return machine-readable JSON output
  -b, --baudrate[=-1]   Set remote baud rate [bps]
  -p, --parity          Set remote parity [odd|even|none]
  -d, --databits[=-1]   Set remote data bits [5|6|7|8]
  -s, --stopbits[=-1]   Set remote stop bits [1|2]
  -v, --version         Show version

Multiplatform notes

GNU/Linux

All functionality is available. This software is mainly tested on GNU/Linux so it should work well.

Windows

Occasionally tested.

Raw terminal has been ported and workarounds have been implemented for missing system functionality. Everything should work perfectly except for TTY support, which is not supported by Windows itself (afaik).

Text selection is disabled since it messes up the WebSocket communication. If you know workarounds, hit me up.

macOS

Occasionally tested, everything except for TTY support should work well.,

Android (with Bionic libc)

It only seems to build for aarch64. Not tested. Other builds may work with with additional configuration tweaks. TTY support is likely to require additional permissions.

OpenWRT (or other distros with uClibc)

Tested on recent releases, it should work very well but huge 5MB binaries don't make it a very good fit on cheap routers.

Other Non-GNU/Linux (i.e musl libc)

Not tested, will likely work but YMMV.

Other BSD

Not tested, most things will likely work. TTY support may work or it may crash the program.

License

GNU General Public License v3.0 or later

Documentation

Index

Constants

View Source
const (
	ImplementationTtyd = iota
	ImplementationWiSe
)
View Source
const (
	UrlForToken = iota
	UrlForWebSocket
	UrlForStty
	UrlForStats
	UrlForWhoami
)
View Source
const COPYRIGHT = "Copyright (c) 2022 Davide Depau\n\n" +
	"License: GNU GPL version 3.0 or later <https://www.gnu.org/licenses/gpl-3.0.html>.\n" +
	"This is free software; see the source for copying conditions.  There is NO\n" +
	"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
View Source
const VERSION = "v0.4"

Variables

View Source
var Strftime, _ = strftimeMod.New("%H:%M:%S")

Functions

func GetUrlFor

func GetUrlFor(urlFor int, baseURL *url.URL) (outUrl *url.URL)

func PlatformGray

func PlatformGray() string

func PlatformYellow

func PlatformYellow() string

func TtycAngryPrintf

func TtycAngryPrintf(format string, args ...interface{})

Cause why not

func TtycErrFprintf

func TtycErrFprintf(w io.Writer, format string, a ...interface{})

func TtycErrPrintf

func TtycErrPrintf(format string, args ...interface{})

func TtycFprintf

func TtycFprintf(w io.Writer, format string, a ...interface{})

func TtycPrintf

func TtycPrintf(format string, args ...interface{})

Types

type Implementation

type Implementation uint8

func Handshake

func Handshake(url *url.URL, credentials *url.Userinfo) (token string, impl Implementation, server string, err error)

type SttyDTO

type SttyDTO struct {
	Baudrate *uint   `json:"baudrate"`
	Databits *uint8  `json:"databits"`
	Stopbits *uint8  `json:"stopbits"`
	Parity   *string `json:"parity"`
}

func GetStty

func GetStty(url *url.URL, credentials *url.Userinfo) (stty SttyDTO, err error)

func Stty

func Stty(url *url.URL, credentials *url.Userinfo, dto *SttyDTO) (stty SttyDTO, err error)

type TokenDTO

type TokenDTO struct {
	Token string `json:"token"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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