Skip to content

Commit 1211f9c

Browse files
colinnewellgconnell
authored andcommitted
Update example to compile.
Also pass through the address info to print to make it clear that's available.
1 parent 142eb2d commit 1211f9c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tcpassembly/tcpreader/reader.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,21 @@
1818
//
1919
// // Create our StreamFactory
2020
// type httpStreamFactory struct {}
21-
// func (f *httpStreamFactory) New(a, b gopacket.Flow) {
22-
// r := tcpreader.NewReaderStream(false)
23-
// go printRequests(r)
21+
// func (f *httpStreamFactory) New(a, b gopacket.Flow) tcpassembly.Stream {
22+
// r := tcpreader.NewReaderStream()
23+
// go printRequests(&r, a, b)
2424
// return &r
2525
// }
26-
// func printRequests(r io.Reader) {
27-
// // Convert to bufio, since that's what ReadRequest wants.
26+
// func printRequests(r io.Reader, a, b gopacket.Flow) {
27+
// // Convert to bufio, since that's what ReadRequest wants.
2828
// buf := bufio.NewReader(r)
2929
// for {
3030
// if req, err := http.ReadRequest(buf); err == io.EOF {
3131
// return
3232
// } else if err != nil {
3333
// log.Println("Error parsing HTTP requests:", err)
3434
// } else {
35+
// fmt.Println(a, b)
3536
// fmt.Println("HTTP REQUEST:", req)
3637
// fmt.Println("Body contains", tcpreader.DiscardBytesToEOF(req.Body), "bytes")
3738
// }

0 commit comments

Comments
 (0)