Ejemplo n.º 1
0
func NewStream(tap *Wiretap, netFlow, tcpFlow gopacket.Flow) *Stream {
	return &Stream{
		ReaderStream: tcpreader.NewReaderStream(),
		tap:          tap,
		flow:         netFlow,
	}
}
Ejemplo n.º 2
0
func (h *httpStreamFactory) New(net, transport gopacket.Flow) tcpassembly.Stream {
	hstream := &httpStream{
		net:       net,
		transport: transport,
		r:         tcpreader.NewReaderStream(),
	}
	go hstream.run() // Important... we must guarantee that data from the reader stream is read.

	// ReaderStream implements tcpassembly.Stream, so we can return a pointer to it.
	return &hstream.r
}
Ejemplo n.º 3
0
func (f httpStreamFactory) New(net, transport gopacket.Flow) tcpassembly.Stream {
	src := transport.Src().String()
	if src == strconv.Itoa(f.port) {
		hstream := &responseStream{
			net:       net,
			transport: transport,
			r:         tcpreader.NewReaderStream(),
		}
		go hstream.run()
		return &hstream.r
	} else {
		hstream := &requestStream{
			net:       net,
			transport: transport,
			r:         tcpreader.NewReaderStream(),
		}
		go hstream.run()
		return &hstream.r
	}
}