Try to dissect with looping through all the extensions

This commit is contained in:
M. Mert Yildiran 2021-08-25 16:38:39 +03:00
parent b2a07f37a4
commit becb8d1618
No known key found for this signature in database
GPG Key ID: D42ADB236521BF7A

View File

@ -5,6 +5,7 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"io" "io"
"log"
"sync" "sync"
"time" "time"
@ -93,16 +94,18 @@ func (h *tcpReader) Read(p []byte) (int, error) {
func (h *tcpReader) run(wg *sync.WaitGroup) { func (h *tcpReader) run(wg *sync.WaitGroup) {
defer wg.Done() defer wg.Done()
data, _ := io.ReadAll(h) data, err := io.ReadAll(h)
if err != nil {
log.Printf("Corrupted TCP stream, unable to read!")
return
}
r := bytes.NewReader(data) r := bytes.NewReader(data)
b := bufio.NewReader(r) for _, extension := range extensions {
for _, isClient := range []bool{true, false} {
extensions[1].Dissector.Dissect(b, true, h.tcpID, h.Emitter)
r.Reset(data) r.Reset(data)
b := bufio.NewReader(r)
b = bufio.NewReader(r) extension.Dissector.Dissect(b, isClient, h.tcpID, h.Emitter)
}
extensions[1].Dissector.Dissect(b, false, h.tcpID, h.Emitter) }
} }