Documentation ¶
Overview ¶
Package marbl provides HTTP traffic logs streamed over websockets that can be added to any point within a Martian modifier tree. Marbl transmits HTTP logs that are serialized based on the following schema:
Frame Header FrameType uint8 MessageType uint8 ID [8]byte Payload HeaderFrame/DataFrame
Header Frame NameLen uint32 ValueLen uint32 Name variable Value variable
Data Frame Index uint32 Terminal uint8 Len uint32 Data variable
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct { ID string MessageType MessageType Index uint32 Terminal bool Data []byte }
Data is the payload (body) of the request or response.
type FrameType ¶
type FrameType uint8
FrameType indicates whether the frame contains a Header or Data.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler exposes marbl logs over websockets.
func NewHandler ¶
func NewHandler() *Handler
NewHandler instantiates a Handler with an empty set of subscriptions.
type Header ¶
type Header struct { ID string MessageType MessageType Name string Value string }
Header is either an HTTP header or meta-data pertaining to the request or response.
type MessageType ¶
type MessageType uint8
MessageType incicates whether the message represents an HTTP request or response.
const ( // Unknown type of Message. Unknown MessageType = 0x0 // Request indicates a message that contains an HTTP request. Request MessageType = 0x1 // Response indicates a message that contains an HTTP response. Response MessageType = 0x2 )
type Modifier ¶
type Modifier struct {
// contains filtered or unexported fields
}
Modifier implements the Martian modifier interface so that marbl logs can be captured at any point in a Martian modifier tree.
func NewModifier ¶
NewModifier returns a marbl.Modifier initialized with a marbl.Stream.
func (*Modifier) ModifyRequest ¶
ModifyRequest writes an HTTP request to the log stream.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader wraps a buffered Reader that reads from the io.Reader and emits Frames.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream writes logs of requests and responses to a writer.
func NewStream ¶
NewStream initializes a Stream with an io.Writer to log requests and responses to. Upon construction, a goroutine is started that listens for frames and writes them to w.
func (*Stream) Close ¶
Close signals Stream to stop listening for frames in the log loop and stop writing logs.
func (*Stream) LogRequest ¶
LogRequest writes an http.Request to Stream with an id unique for the request / response pair.