listen

package
v0.2.4-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package listen forwards live events to a local port.

The connection is opened OUTBOUND from this machine. That is what removes the need for a tunnel: no public URL, no inbound port, and it works behind NAT and corporate firewalls because it is an ordinary outgoing HTTPS connection.

Shape of the loop: create a session over HTTP, dial the socket, and for each frame that arrives POST it to the local target and report the result back up the socket. Reconnect with backoff when the socket drops, because laptops sleep, wifi flaps, and the server cycles connections on deploy.

Index

Constants

This section is empty.

Variables

View Source
var (
	Green  = ""
	Red    = ""
	Yellow = ""
	Dim    = ""
	Bold   = ""
	Reset  = ""
)

Exported so other commands render the same way. They are set once in init(), after the NO_COLOR and terminal checks, so every command agrees on whether output is coloured rather than each deciding for itself.

Functions

func Run

func Run(ctx context.Context, cfg config.Config, opts Options) error

Run creates a session and forwards until interrupted.

Types

type Frame

type Frame struct {
	Type      string `json:"type"`
	SessionID string `json:"session_id"`
	AttemptID string `json:"attempt_id"`
	EventID   string `json:"event_id"`
	EventType string `json:"event_type"`
	Payload   string `json:"payload"`
	Timestamp int64  `json:"timestamp"`
	Signature string `json:"signature"`
}

Frame is what the server pushes down the socket.

type Options

type Options struct {
	ForwardTo  string
	Events     []string
	DeviceName string
}

Jump to

Keyboard shortcuts

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