protocol

package
v0.0.0-...-0ca64e6 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package protocol contains the types, lexer, and parser that implement the event server protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	NodeID    uint16
	TimeStamp uint32
	Size      uint16
	EventUUID UUID
	Payload   map[string]string
	Protocol  Protocol
	Submitter uint32
	CheckSum  uint32

	PayloadBytes []byte
	IP           netip.Addr
}

Event is a server-emitted event.

func (*Event) MarshalBinary

func (e *Event) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

This method marshals the entire Event object to its binary equivalent, including its CheckSum.

func (*Event) ReadFrom

func (e *Event) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom implements the io.ReaderFrom interface.

func (*Event) Valid

func (e *Event) Valid() bool

Valid returns true if the Event's CheckSum value matches the calculated CRC-32 checksum of all other Event field values using the IEEE polynomial.

type Protocol

type Protocol uint16

Protocol is a network protocol type

const (
	// HTTP represents an event using the HTTP protocol
	HTTP Protocol = 0x0A

	// SMTP represents an event using the SMTP protocol
	SMTP Protocol = 0x11

	// SSH represents an event using the SSH protocol
	SSH Protocol = 0x31

	// TELNET represents an event using the Teletype Network protocol
	TELNET Protocol = 0x23
)

func (Protocol) String

func (p Protocol) String() string

String implements the fmt.Stringer interface.

type UUID

type UUID struct {
	TimeLow          uint32
	TimeMid          uint16
	TimeHiAndVersion uint16
	ClockSeqHiAndRes byte
	ClockSeqLow      byte
	Node             [6]byte
}

UUID is a 128-bit universally unique identifier using the format described at: https://en.wikipedia.org/wiki/Universally_unique_identifier#Format

I confirmed this is the expected format by taking a peek at the type in the emitter binary.

func (*UUID) ReadFrom

func (u *UUID) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom implements the io.ReaderFrom interface.

func (*UUID) String

func (u *UUID) String() string

String implements the fmt.Stringer interface.

Jump to

Keyboard shortcuts

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