Compare commits

...

2 Commits

Author SHA1 Message Date
David Levanon
b5c665b602 set capture time for every packet, so long living readers would be accurate (#1043) 2022-04-26 14:37:44 +03:00
David Levanon
fadd052f02 init tls entries capture time (#1042) 2022-04-25 13:42:52 +03:00
2 changed files with 7 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"net"
"sync"
"time"
"encoding/binary"
"encoding/hex"
@@ -130,6 +131,7 @@ func (p *tlsPoller) handleTlsChunk(chunk *tlsChunk, extension *api.Extension,
p.readers[key] = reader
}
reader.timer.CaptureTime = time.Now()
reader.chunks <- chunk
if os.Getenv("MIZU_VERBOSE_TLS_TAPPER") == "true" {
@@ -149,6 +151,9 @@ func (p *tlsPoller) startNewTlsReader(chunk *tlsChunk, ip net.IP, port uint16, k
p.closeReader(key, r)
},
progress: &api.ReadProgress{},
timer: api.SuperTimer{
CaptureTime: time.Now(),
},
}
tcpid := p.buildTcpId(chunk, ip, port)
@@ -167,7 +172,7 @@ func dissect(extension *api.Extension, reader *tlsReader, isRequest bool, tcpid
b := bufio.NewReader(reader)
err := extension.Dissector.Dissect(b, reader.progress, api.Ebpf, isRequest, tcpid, &api.CounterPair{},
&api.SuperTimer{}, &api.SuperIdentifier{}, tlsEmitter, options, reqResMatcher)
&reader.timer, &api.SuperIdentifier{}, tlsEmitter, options, reqResMatcher)
if err != nil {
logger.Log.Warningf("Error dissecting TLS %v - %v", tcpid, err)

View File

@@ -13,6 +13,7 @@ type tlsReader struct {
data []byte
doneHandler func(r *tlsReader)
progress *api.ReadProgress
timer api.SuperTimer
}
func (r *tlsReader) Read(p []byte) (int, error) {