Documentation
¶
Index ¶
- Constants
- Variables
- func ChunkOutput(data []byte) [][]byte
- func DecodeControl(tag byte, payload []byte, dst any) error
- func DeriveKeys(secret, serverNonce, clientNonce []byte) (c2s, s2c [32]byte, err error)
- func EncodeControl(tag byte, value any) ([]byte, error)
- func PairingURL(publicURL string, secret Secret) (string, error)
- func ParseCloudflaredVersion(output string) (string, error)
- func TerminalQR(pairingURL string) (string, error)
- func ValidateClientFrame(tag byte, value any) error
- func ValidateServerFrame(tag byte, value any) error
- type Client
- type ClientHandler
- type ClientHello
- type DiagnosticRecord
- type DiagnosticSink
- type DiagnosticSinkFunc
- type Event
- type HostSession
- type Identity
- type LocalServer
- type Manager
- func (m *Manager) ClientCount() int
- func (m *Manager) Close(client *Client) error
- func (m *Manager) Connected(ctx context.Context, client *Client) error
- func (m *Manager) Disconnected(client *Client)
- func (m *Manager) Events() <-chan Event
- func (m *Manager) Input(client *Client, data []byte) error
- func (m *Manager) Rotate(ctx context.Context) error
- func (m *Manager) Shutdown(ctx context.Context) error
- func (m *Manager) Snapshot() Snapshot
- func (m *Manager) Start(ctx context.Context) error
- type ManagerOptions
- type Opener
- type PTYViewerFactory
- type PreparedViewer
- type ProtocolError
- type Ready
- type Sealer
- type Secret
- type ServerOptions
- type ServerResource
- type Shutdown
- type Snapshot
- type State
- type Tunnel
- type TunnelOptions
- type TunnelResource
- type Viewer
- type ViewerFactory
- type ViewerGeometry
- type ViewerGeometryDiagnostic
Constants ¶
View Source
const ( ProtocolVersion = 3 TagClientHello byte = 0x01 TagClose byte = 0x05 TagInput byte = 0x06 TagOutput byte = 0x07 TagReady byte = 0x08 TagShutdown byte = 0x0a TagError byte = 0x0b MaxWireMessage = 128 << 10 MaxClientQueueBytes = 1 << 20 MaxHandshakes = 16 MaxClients = 8 HandshakeTimeout = 5 * time.Second TunnelStartupTimeout = 30 * time.Second )
Variables ¶
View Source
var ( ErrCipherPoisoned = errors.New("mirror cipher is poisoned") ErrCounterExhausted = errors.New("mirror cipher counter exhausted") )
View Source
var ErrClientQueueFull = errors.New("mirror client outbound queue is full")
Functions ¶
func ChunkOutput ¶
func DeriveKeys ¶
func ParseCloudflaredVersion ¶
func TerminalQR ¶
func ValidateClientFrame ¶
func ValidateServerFrame ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) SendControl ¶
type ClientHandler ¶
type ClientHello ¶
type ClientHello struct {
Version int `json:"version"`
}
type DiagnosticRecord ¶
type DiagnosticSink ¶
type DiagnosticSink interface {
Write(DiagnosticRecord) error
}
func NewJSONLDiagnosticSink ¶
func NewJSONLDiagnosticSink(path string) DiagnosticSink
type DiagnosticSinkFunc ¶
type DiagnosticSinkFunc func(DiagnosticRecord) error
func (DiagnosticSinkFunc) Write ¶
func (f DiagnosticSinkFunc) Write(record DiagnosticRecord) error
type HostSession ¶
type LocalServer ¶
type LocalServer struct {
// contains filtered or unexported fields
}
func StartLocalServer ¶
func StartLocalServer(ctx context.Context, options ServerOptions) (*LocalServer, error)
func (*LocalServer) LocalURL ¶
func (s *LocalServer) LocalURL() string
func (*LocalServer) ServeHTTP ¶
func (s *LocalServer) ServeHTTP(response http.ResponseWriter, request *http.Request)
func (*LocalServer) SetPublicHost ¶
func (s *LocalServer) SetPublicHost(host string)
func (*LocalServer) SetSecret ¶
func (s *LocalServer) SetSecret(secret Secret)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(options ManagerOptions) (*Manager, error)
func (*Manager) ClientCount ¶
func (*Manager) Disconnected ¶
type ManagerOptions ¶
type ManagerOptions struct {
Workspace string
Target *HostSession
Viewers ViewerFactory
StartServer func(context.Context, ServerOptions) (ServerResource, error)
StartTunnel func(context.Context, string) (TunnelResource, error)
Random io.Reader
Diagnostics DiagnosticSink
}
type PTYViewerFactory ¶
type PTYViewerFactory struct {
SessionSocket string
Endpoint tmux.Endpoint
TmuxPath string
Environment []string
Record func(DiagnosticRecord)
// contains filtered or unexported fields
}
func (*PTYViewerFactory) Cleanup ¶
func (f *PTYViewerFactory) Cleanup() error
Cleanup retries restoration for pins whose last viewer has already exited. Failed pins stay in the factory so a later lifecycle cleanup can try again.
func (*PTYViewerFactory) Prepare ¶
func (f *PTYViewerFactory) Prepare( ctx context.Context, identity Identity, output func([]byte) error, ) (PreparedViewer, error)
type PreparedViewer ¶
type PreparedViewer interface {
Geometry() ViewerGeometry
Start() (Viewer, error)
Close() error
}
type ProtocolError ¶
type ServerOptions ¶
type ServerOptions struct {
Secret Secret
PublicHost string
Handler ClientHandler
Random io.Reader
Record func(DiagnosticRecord)
}
type ServerResource ¶
type TunnelOptions ¶
type TunnelOptions struct {
LookPath pathLookup
Command commandFactory
StartupTimeout time.Duration
StopTimeout time.Duration
Record func(DiagnosticRecord)
}
type TunnelResource ¶
type ViewerFactory ¶
type ViewerGeometry ¶
type ViewerGeometryDiagnostic ¶
type ViewerGeometryDiagnostic struct {
CapturedColumns uint16 `json:"captured_columns"`
CapturedRows uint16 `json:"captured_rows"`
ClientColumns uint16 `json:"client_columns"`
ClientRows uint16 `json:"client_rows"`
WindowColumns uint16 `json:"window_columns"`
WindowRows uint16 `json:"window_rows"`
StatusRows uint16 `json:"status_rows"`
Corrected bool `json:"corrected"`
}
Click to show internal directories.
Click to hide internal directories.