tcp

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionAddress added in v0.0.3

type ConnectionAddress struct {
	IP, Port gopacket.Flow
}

func (ConnectionAddress) MarshalJSON added in v0.0.3

func (c ConnectionAddress) MarshalJSON() ([]byte, error)

func (ConnectionAddress) String added in v0.0.3

func (c ConnectionAddress) String() string

type ConnectionReader

type ConnectionReader interface {
	ReadStream(r Stream, a, b gopacket.Flow, completed chan interface{})
}

type SavePointReader

type SavePointReader struct {
	// contains filtered or unexported fields
}

SavePointReader is a reader that allows you to save a point in the stream to allow you to roll back to it. This allows you to pass it to a parser, have it go down a dead end as you realise it's not that type of data, and roll back to that point to try a different parser. This is done by storing the data being read, so do Reset the save point once you have determined you're going down the correct path.

Note that if this is wrapped within something like a bufio.Reader you may need to construct a fresh wrapper to prevent the buffering from adversely affecting your results when restoring back to a save point.

func NewSavePointReader

func NewSavePointReader(r io.Reader) *SavePointReader

NewSavePointReader wrap an io.Reader in a SavePointReader and return the new SavePointReader.

func (*SavePointReader) Read

func (sp *SavePointReader) Read(p []byte) (read int, err error)

Read standard io.Reader method.

func (*SavePointReader) Reset

func (sp *SavePointReader) Reset()

Reset drops the save point. You should aim to do this as soon as possible as this will make a copy of what's read as long as a save point is in actions.

func (*SavePointReader) Restore

func (sp *SavePointReader) Restore(discardSavePoint bool)

Restore roll the reader back to the save point.

If you're sure you're not going to need to restore again you can discard the save point and avoid continuing to populate the buffer as you continue reading onwards.

func (*SavePointReader) SavePoint

func (sp *SavePointReader) SavePoint()

SavePoint store the position in the reader so that it can be rolled back to this point to be read from again.

type Stream

type Stream interface {
	Read(p []byte) (n int, err error)
	Seen() (time.Time, error)
}

type StreamFactory

type StreamFactory struct {
	// contains filtered or unexported fields
}

func NewFactory

func NewFactory(r ConnectionReader) *StreamFactory

func (*StreamFactory) New

func (*StreamFactory) Output

func (f *StreamFactory) Output(w io.Writer, outputFunc func(io.Writer, chan interface{}))

type TimeCaptureReader

type TimeCaptureReader struct {
	// contains filtered or unexported fields
}

func NewTimeCaptureReader

func NewTimeCaptureReader(r Stream) *TimeCaptureReader

func (*TimeCaptureReader) Read

func (t *TimeCaptureReader) Read(p []byte) (read int, err error)

func (*TimeCaptureReader) Reset

func (t *TimeCaptureReader) Reset()

Reset clears the list of times.

func (*TimeCaptureReader) Seen

func (t *TimeCaptureReader) Seen() []time.Time

Seen return the list of times packets were seen.

Jump to

Keyboard shortcuts

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