wsrepeater

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package wsrepeater opens a fresh WebSocket connection to a target, sends one message, and captures the frames the server returns — a "Repeater" for WebSockets. It speaks enough of RFC 6455 to do this with no external deps: the client handshake, masked client frames, and frame reading. TLS verification is skipped (wss), matching how Interseptor talks to targets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	Dir    string `json:"dir"` // "send" | "recv"
	Opcode int    `json:"opcode"`
	Text   string `json:"text"`
	Len    int    `json:"len"`
}

Frame is one sent or received WebSocket frame.

type Request

type Request struct {
	URL     string            // ws:// wss:// (http/https also accepted)
	Message string            // payload to send
	Binary  bool              // send a binary frame instead of text
	Headers map[string]string // extra handshake headers (Cookie, Authorization, …)
	ReadFor time.Duration     // how long to collect response frames (default 2s)
}

Request is one WebSocket send.

type Result

type Result struct {
	Status int     `json:"status"` // handshake HTTP status (101 on success)
	Frames []Frame `json:"frames"`
}

Result is the handshake status plus the sent and received frames.

func Send

func Send(req Request) (*Result, error)

Send performs the handshake, sends the message, and returns the exchange.

Jump to

Keyboard shortcuts

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