Documentation ¶
Index ¶
- Constants
- type Flow
- type Http2Flags
- type Http2Frame
- func (f *Http2Frame) Append(raw []byte)
- func (f *Http2Frame) Complete() bool
- func (f *Http2Frame) Flags() Http2Flags
- func (f *Http2Frame) Headers() ([]hpack.HeaderField, error)
- func (f *Http2Frame) HeadersText() string
- func (f *Http2Frame) IsRequest() bool
- func (f *Http2Frame) Length() uint32
- func (f *Http2Frame) Payload() []byte
- func (f *Http2Frame) StreamID() uint32
- func (f *Http2Frame) Type() uint8
- type Http2Stream
- type SocketHttp11
- func (socket *SocketHttp11) AddFlowCallback(callback func(Flow))
- func (socket *SocketHttp11) Clear()
- func (socket *SocketHttp11) Key() string
- func (socket *SocketHttp11) ProcessConnectEvent(event *events.ConnectEvent)
- func (socket *SocketHttp11) ProcessDataEvent(event *events.DataEvent)
- func (socket *SocketHttp11) ProcessGetsocknameEvent(event *events.GetsocknameEvent)
- type SocketHttp2
- func (socket *SocketHttp2) AddFlowCallback(callback func(Flow))
- func (socket *SocketHttp2) Clear()
- func (socket *SocketHttp2) Key() string
- func (socket *SocketHttp2) ProcessConnectEvent(event *events.ConnectEvent)
- func (socket *SocketHttp2) ProcessDataEvent(event *events.DataEvent)
- func (socket *SocketHttp2) ProcessGetsocknameEvent(event *events.GetsocknameEvent)
- type SocketI
- type SocketMap
- func (m *SocketMap) AddFlowCallback(callback func(Flow))
- func (m *SocketMap) Debug()
- func (m *SocketMap) ProcessCloseEvent(event events.CloseEvent)
- func (m *SocketMap) ProcessConnectEvent(event events.ConnectEvent)
- func (m *SocketMap) ProcessDataEvent(event events.DataEvent)
- func (m *SocketMap) ProcessGetsocknameEvent(event events.GetsocknameEvent)
- type SocketUnknown
- func (socket *SocketUnknown) AddFlowCallback(callback func(Flow))
- func (socket *SocketUnknown) Clear()
- func (socket *SocketUnknown) Key() string
- func (socket *SocketUnknown) ProcessConnectEvent(event *events.ConnectEvent)
- func (socket *SocketUnknown) ProcessDataEvent(event *events.DataEvent)
- func (socket *SocketUnknown) ProcessGetsocknameEvent(event *events.GetsocknameEvent)
Constants ¶
const ( HTTP = "http" HTTP2 = "http2" Unknown = "unknown" )
const ZeroAddr = "0.0.0.0:0"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flow ¶
type Flow struct { UUID string SourceAddr string DestAddr string L4Protocol string L7Protocol string Request []byte Response []byte PID int FD int }
Flow represents an exchange of data over a socket in the form of request + response.
func NewFlowResponse ¶
func (*Flow) AddData ¶
AddData adds bytes onto either the request or the response depending on which type the flow is
func (*Flow) AddResponse ¶
type Http2Flags ¶
type Http2Frame ¶
type Http2Frame struct {
// contains filtered or unexported fields
}
func NewHttp2Frame ¶
func NewHttp2Frame(raw []byte) *Http2Frame
func ParseBytesToFrames ¶
func ParseBytesToFrames(raw []byte) ([]*Http2Frame, []byte)
ParseBytesToFrames parses a byte array into zero or more complete Http2Frames. If there is an incomplete frame then the for it are return as the second return value. Its implemented like this because Go can send multiple frames in the same call, or send the same frame over multiple calls.
func (*Http2Frame) Append ¶
func (f *Http2Frame) Append(raw []byte)
func (*Http2Frame) Complete ¶
func (f *Http2Frame) Complete() bool
Cases (first 3 bytes are the length):
[00 00 10] => incomplete [00 00 00] => incomplete [00 00 00 04 01] => incomplete [00 00 00 04 01 00 00 00 00] => complete [00 00 03 04 01 00 00 00 00 01 02 03] => complete
func (*Http2Frame) Flags ¶
func (f *Http2Frame) Flags() Http2Flags
func (*Http2Frame) Headers ¶
func (f *Http2Frame) Headers() ([]hpack.HeaderField, error)
func (*Http2Frame) HeadersText ¶
func (f *Http2Frame) HeadersText() string
HeadersText converts this to an HTTP1.1 formatted message
func (*Http2Frame) IsRequest ¶
func (f *Http2Frame) IsRequest() bool
func (*Http2Frame) Length ¶
func (f *Http2Frame) Length() uint32
func (*Http2Frame) Payload ¶
func (f *Http2Frame) Payload() []byte
func (*Http2Frame) StreamID ¶
func (f *Http2Frame) StreamID() uint32
func (*Http2Frame) Type ¶
func (f *Http2Frame) Type() uint8
type Http2Stream ¶
type Http2Stream struct {
// contains filtered or unexported fields
}
func NewHttp2Stream ¶
func NewHttp2Stream() *Http2Stream
func (*Http2Stream) ProcessFrame ¶
func (stream *Http2Stream) ProcessFrame(frame *Http2Frame) *Flow
type SocketHttp11 ¶
type SocketHttp11 struct { SourceAddr string DestAddr string Protocol string PID uint32 TID uint32 FD uint32 SSL bool // contains filtered or unexported fields }
func NewSocketHttp11 ¶
func NewSocketHttp11(event *events.ConnectEvent) SocketHttp11
func NewSocketHttp11FromUnknown ¶
func NewSocketHttp11FromUnknown(unkownSocket *SocketUnknown) SocketHttp11
func (*SocketHttp11) AddFlowCallback ¶
func (socket *SocketHttp11) AddFlowCallback(callback func(Flow))
func (*SocketHttp11) Clear ¶
func (socket *SocketHttp11) Clear()
func (*SocketHttp11) Key ¶
func (socket *SocketHttp11) Key() string
func (*SocketHttp11) ProcessConnectEvent ¶
func (socket *SocketHttp11) ProcessConnectEvent(event *events.ConnectEvent)
ProcessConnectEvent is called when the connect event arrives after the data event
func (*SocketHttp11) ProcessDataEvent ¶
func (socket *SocketHttp11) ProcessDataEvent(event *events.DataEvent)
func (*SocketHttp11) ProcessGetsocknameEvent ¶
func (socket *SocketHttp11) ProcessGetsocknameEvent(event *events.GetsocknameEvent)
type SocketHttp2 ¶
type SocketHttp2 struct { SourceAddr string DestAddr string Protocol string PID uint32 TID uint32 FD uint32 SSL bool // contains filtered or unexported fields }
func NewSocketHttp2 ¶
func NewSocketHttp2(event *events.ConnectEvent) SocketHttp2
func NewSocketHttp2FromUnknown ¶
func NewSocketHttp2FromUnknown(unkownSocket *SocketUnknown) SocketHttp2
func (*SocketHttp2) AddFlowCallback ¶
func (socket *SocketHttp2) AddFlowCallback(callback func(Flow))
func (*SocketHttp2) Clear ¶
func (socket *SocketHttp2) Clear()
func (*SocketHttp2) Key ¶
func (socket *SocketHttp2) Key() string
func (*SocketHttp2) ProcessConnectEvent ¶
func (socket *SocketHttp2) ProcessConnectEvent(event *events.ConnectEvent)
ProcessConnectEvent is called when the connect event arrives after the data event
func (*SocketHttp2) ProcessDataEvent ¶
func (socket *SocketHttp2) ProcessDataEvent(event *events.DataEvent)
TODO: Have a structure for handling the frame header + payload?
func (*SocketHttp2) ProcessGetsocknameEvent ¶
func (socket *SocketHttp2) ProcessGetsocknameEvent(event *events.GetsocknameEvent)
type SocketI ¶
type SocketI interface { Key() string AddFlowCallback(callback func(Flow)) ProcessConnectEvent(event *events.ConnectEvent) ProcessDataEvent(event *events.DataEvent) ProcessGetsocknameEvent(event *events.GetsocknameEvent) Clear() }
type SocketMap ¶
type SocketMap struct {
// contains filtered or unexported fields
}
SocketMap tracks sockets which have been observed in ebpf
func NewSocketMap ¶
func NewSocketMap() *SocketMap
func (*SocketMap) AddFlowCallback ¶
func (*SocketMap) ProcessCloseEvent ¶
func (m *SocketMap) ProcessCloseEvent(event events.CloseEvent)
func (*SocketMap) ProcessConnectEvent ¶
func (m *SocketMap) ProcessConnectEvent(event events.ConnectEvent)
func (*SocketMap) ProcessDataEvent ¶
func (*SocketMap) ProcessGetsocknameEvent ¶
func (m *SocketMap) ProcessGetsocknameEvent(event events.GetsocknameEvent)
type SocketUnknown ¶
type SocketUnknown struct { SourceAddr string DestAddr string Protocol string PID uint32 TID uint32 FD uint32 SSL bool // contains filtered or unexported fields }
func NewSocketUnknown ¶
func NewSocketUnknown(event *events.ConnectEvent) SocketUnknown
func (*SocketUnknown) AddFlowCallback ¶
func (socket *SocketUnknown) AddFlowCallback(callback func(Flow))
func (*SocketUnknown) Clear ¶
func (socket *SocketUnknown) Clear()
func (*SocketUnknown) Key ¶
func (socket *SocketUnknown) Key() string
func (*SocketUnknown) ProcessConnectEvent ¶
func (socket *SocketUnknown) ProcessConnectEvent(event *events.ConnectEvent)
func (*SocketUnknown) ProcessDataEvent ¶
func (socket *SocketUnknown) ProcessDataEvent(event *events.DataEvent)
func (*SocketUnknown) ProcessGetsocknameEvent ¶
func (socket *SocketUnknown) ProcessGetsocknameEvent(event *events.GetsocknameEvent)