Skip to content

Commit

Permalink
chore: remove debugging prints
Browse files Browse the repository at this point in the history
Signed-off-by: Gaukas Wang <i@gaukas.wang>
  • Loading branch information
gaukas committed May 31, 2024
1 parent 5ddd49b commit 50e1478
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
4 changes: 2 additions & 2 deletions internal/utils/uint8_not_string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ func TestUint8Arr(t *testing.T) {
}

// testStruct: {Name:gaukas Age:18 Topics:[72 101 108 108 111]}
m, err := json.Marshal(testStruct)
_, err := json.Marshal(testStruct)
if err != nil {
t.Fatalf("json.Marshal error: %v", err)
}
t.Logf("json.Marshal: %s", m)
// t.Logf("json.Marshal: %s", m)
}
4 changes: 0 additions & 4 deletions quic_clienthello_reconstructor.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ func (qchr *QUICClientHelloReconstructor) AddCRYPTOFragment(offset uint64, frag
// Check for offset and length: must not be exceeding
// the maximum length of a CRYPTO frame.
if offset+uint64(len(frag)) > maxCRYPTOLength {
// log.Printf("offset too high: %d + %d > %d", offset, len(frag), maxCRYPTOLength)
return ErrOffsetTooHigh
}

Expand Down Expand Up @@ -102,15 +101,12 @@ func (qchr *QUICClientHelloReconstructor) AddCRYPTOFragment(offset uint64, frag
}) + 4 // Handshake Type (1) + uint24 Length (3) + ClientHello body

if qchr.fullLen > maxCRYPTOLength {
// log.Printf("offset too high: %d > %d", qchr.fullLen, maxCRYPTOLength)
return ErrOffsetTooHigh
}
}
}

if qchr.fullLen > 0 && uint32(len(qchr.buf)) >= qchr.fullLen { // if we have at least the full length bytes of data, we conclude the CRYPTO frame is complete
// log.Printf("fullLen: %d, buf: %d, completed!", qchr.fullLen, len(qchr.buf))
// log.Printf("First 4 bytes from buf: %x", qchr.buf[:4])
return io.EOF // io.EOF means no more fragments expected
}

Expand Down
14 changes: 0 additions & 14 deletions quic_fingerprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ package clienthellod
import (
"crypto/sha1" // skipcq: GSC-G505
"encoding/binary"
"encoding/json"
"errors"
"io"
"log"
"net"
"runtime"
"sync"
Expand Down Expand Up @@ -91,11 +89,6 @@ func (qfp *QUICFingerprinter) HandlePacket(from string, p []byte) error {
}
return err
}
b, err := json.Marshal(ci)
if err != nil {
return err
}
log.Printf("ClientInitial: %s", string(b))

var testGci *GatheredClientInitials
if qfp.timeout == time.Duration(0) {
Expand All @@ -110,7 +103,6 @@ func (qfp *QUICFingerprinter) HandlePacket(from string, p []byte) error {
funcExpiringAfter := func(d time.Duration) {
<-time.After(d)
qfp.mapGatheringClientInitials.Delete(from)
log.Printf("GatheredClientInitials for %s expired", from)
}

if qfp.timeout == time.Duration(0) {
Expand Down Expand Up @@ -209,12 +201,6 @@ func (qfp *QUICFingerprinter) LookupAwait(from string) (*QUICFingerprint, error)
return nil, errors.New("GatheredClientInitials loaded from sync.Map failed type assertion")
}

b, err := json.Marshal(gatheredCI)
if err != nil {
return nil, err
}
log.Printf("Found GatheredClientInitials: %s", string(b))

qf, err := GenerateQUICFingerprint(gatheredCI)
if err != nil {
return nil, err
Expand Down

0 comments on commit 50e1478

Please sign in to comment.