client

package
v0.0.0-...-41d5bde Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorEvent

type ErrorEvent struct {
	Error string `json:"error"`
}

type Event

type Event struct {
	Type    EventType   `json:"type"`
	Payload interface{} `json:"payload"`
}

type EventHandler

type EventHandler func(event Event)

type EventType

type EventType string
const (
	EventTypeRequest EventType = "request"
	EventTypeError   EventType = "error"
)

type RequestEvent

type RequestEvent struct {
	TunnelID  string
	Method    string
	Path      string
	Status    int
	Duration  time.Duration
	Error     string
	Timestamp time.Time

	// ConnectionFailed is set to true if the manager lost connection to the server
	ConnectionFailed bool
}

type Tunnel

type Tunnel interface {
	// URL returns the public URL of the tunnel
	URL() string
	// LocalPort returns the local port of the tunnel
	LocalPort() int
	// Close closes the specific tunnel instance
	Close() error
}

type TunnelManager

type TunnelManager interface {
	// NewTunnel creates a new tunnel with an optional ID and returns it
	NewTunnel(localPort int, customId string) (Tunnel, error)
	// Tunnels returns all active tunnels
	Tunnels() []Tunnel
	// Close cleans up and closes all active tunnels
	Close() error
}

func NewTunnelManager

func NewTunnelManager(cfg *config.ClientConfig, logger *slog.Logger, events EventHandler) TunnelManager

Jump to

Keyboard shortcuts

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