diff --git a/.clusterfuzzlite/build.sh b/.clusterfuzzlite/build.sh index 92a24169..e7a9d411 100755 --- a/.clusterfuzzlite/build.sh +++ b/.clusterfuzzlite/build.sh @@ -2,8 +2,8 @@ export CXX="${CXX} -lresolv" # required by Go 1.20 -compile_go_fuzzer github.com/quic-go/quic-go/fuzzing/frames Fuzz frame_fuzzer -compile_go_fuzzer github.com/quic-go/quic-go/fuzzing/header Fuzz header_fuzzer -compile_go_fuzzer github.com/quic-go/quic-go/fuzzing/transportparameters Fuzz transportparameter_fuzzer -compile_go_fuzzer github.com/quic-go/quic-go/fuzzing/tokens Fuzz token_fuzzer -compile_go_fuzzer github.com/quic-go/quic-go/fuzzing/handshake Fuzz handshake_fuzzer +compile_go_fuzzer github.com/refraction-networking/uquic/fuzzing/frames Fuzz frame_fuzzer +compile_go_fuzzer github.com/refraction-networking/uquic/fuzzing/header Fuzz header_fuzzer +compile_go_fuzzer github.com/refraction-networking/uquic/fuzzing/transportparameters Fuzz transportparameter_fuzzer +compile_go_fuzzer github.com/refraction-networking/uquic/fuzzing/tokens Fuzz token_fuzzer +compile_go_fuzzer github.com/refraction-networking/uquic/fuzzing/handshake Fuzz handshake_fuzzer diff --git a/.github/workflows/clusterfuzz-lite-pr.yml b/.github/workflows/clusterfuzz-lite-pr.yml deleted file mode 100644 index c902db19..00000000 --- a/.github/workflows/clusterfuzz-lite-pr.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: ClusterFuzzLite PR fuzzing -on: - pull_request: - paths: - - '**' - -permissions: read-all -jobs: - PR: - runs-on: ${{ fromJSON(vars['CLUSTERFUZZ_LITE_RUNNER_UBUNTU'] || '"ubuntu-latest"') }} - concurrency: - group: ${{ github.workflow }}-${{ matrix.sanitizer }}-${{ github.ref }} - cancel-in-progress: true - strategy: - fail-fast: false - matrix: - sanitizer: - - address - steps: - - name: Build Fuzzers (${{ matrix.sanitizer }}) - id: build - uses: google/clusterfuzzlite/actions/build_fuzzers@v1 - with: - language: go - github-token: ${{ secrets.GITHUB_TOKEN }} - sanitizer: ${{ matrix.sanitizer }} - # Optional but recommended: used to only run fuzzers that are affected - # by the PR. - # See later section on "Git repo for storage". - # storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/OWNER/STORAGE-REPO-NAME.git - # storage-repo-branch: main # Optional. Defaults to "main" - # storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages". - - name: Run Fuzzers (${{ matrix.sanitizer }}) - id: run - uses: google/clusterfuzzlite/actions/run_fuzzers@v1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - fuzz-seconds: 480 - mode: 'code-change' - sanitizer: ${{ matrix.sanitizer }} - output-sarif: true - parallel-fuzzing: true - # Optional but recommended: used to download the corpus produced by - # batch fuzzing. - # See later section on "Git repo for storage". - # storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/OWNER/STORAGE-REPO-NAME.git - # storage-repo-branch: main # Optional. Defaults to "main" - # storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages". diff --git a/http3/error.go b/http3/error.go index b96ebeec..fc41f544 100644 --- a/http3/error.go +++ b/http3/error.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - "github.com/quic-go/quic-go" + quic "github.com/refraction-networking/uquic" ) // Error is returned from the round tripper (for HTTP clients) diff --git a/http3/error_test.go b/http3/error_test.go index 71567128..56aa200b 100644 --- a/http3/error_test.go +++ b/http3/error_test.go @@ -3,10 +3,9 @@ package http3 import ( "errors" - "github.com/quic-go/quic-go" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + quic "github.com/refraction-networking/uquic" ) var _ = Describe("HTTP/3 errors", func() { diff --git a/internal/ackhandler/ecn.go b/internal/ackhandler/ecn.go index 68415ac6..6eb943c0 100644 --- a/internal/ackhandler/ecn.go +++ b/internal/ackhandler/ecn.go @@ -3,9 +3,9 @@ package ackhandler import ( "fmt" - "github.com/quic-go/quic-go/internal/protocol" - "github.com/quic-go/quic-go/internal/utils" - "github.com/quic-go/quic-go/logging" + "github.com/refraction-networking/uquic/internal/protocol" + "github.com/refraction-networking/uquic/internal/utils" + "github.com/refraction-networking/uquic/logging" ) type ecnState uint8 diff --git a/internal/ackhandler/ecn_test.go b/internal/ackhandler/ecn_test.go index ab648d81..644a025c 100644 --- a/internal/ackhandler/ecn_test.go +++ b/internal/ackhandler/ecn_test.go @@ -1,10 +1,10 @@ package ackhandler import ( - mocklogging "github.com/quic-go/quic-go/internal/mocks/logging" - "github.com/quic-go/quic-go/internal/protocol" - "github.com/quic-go/quic-go/internal/utils" - "github.com/quic-go/quic-go/logging" + mocklogging "github.com/refraction-networking/uquic/internal/mocks/logging" + "github.com/refraction-networking/uquic/internal/protocol" + "github.com/refraction-networking/uquic/internal/utils" + "github.com/refraction-networking/uquic/logging" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/internal/ackhandler/mock_ecn_handler_test.go b/internal/ackhandler/mock_ecn_handler_test.go index 194ab891..949268f5 100644 --- a/internal/ackhandler/mock_ecn_handler_test.go +++ b/internal/ackhandler/mock_ecn_handler_test.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/quic-go/quic-go/internal/ackhandler (interfaces: ECNHandler) +// Source: github.com/refraction-networking/uquic/internal/ackhandler (interfaces: ECNHandler) // // Generated by this command: // -// mockgen -build_flags=-tags=gomock -package ackhandler -destination mock_ecn_handler_test.go github.com/quic-go/quic-go/internal/ackhandler ECNHandler +// mockgen -build_flags=-tags=gomock -package ackhandler -destination mock_ecn_handler_test.go github.com/refraction-networking/uquic/internal/ackhandler ECNHandler // // Package ackhandler is a generated GoMock package. package ackhandler @@ -11,7 +11,7 @@ package ackhandler import ( reflect "reflect" - protocol "github.com/quic-go/quic-go/internal/protocol" + protocol "github.com/refraction-networking/uquic/internal/protocol" gomock "go.uber.org/mock/gomock" ) diff --git a/internal/ackhandler/mockgen.go b/internal/ackhandler/mockgen.go index 55540cd2..b36c0de1 100644 --- a/internal/ackhandler/mockgen.go +++ b/internal/ackhandler/mockgen.go @@ -5,5 +5,5 @@ package ackhandler //go:generate sh -c "go run go.uber.org/mock/mockgen -build_flags=\"-tags=gomock\" -package ackhandler -destination mock_sent_packet_tracker_test.go github.com/refraction-networking/uquic/internal/ackhandler SentPacketTracker" type SentPacketTracker = sentPacketTracker -//go:generate sh -c "go run go.uber.org/mock/mockgen -build_flags=\"-tags=gomock\" -package ackhandler -destination mock_ecn_handler_test.go github.com/quic-go/quic-go/internal/ackhandler ECNHandler" +//go:generate sh -c "go run go.uber.org/mock/mockgen -build_flags=\"-tags=gomock\" -package ackhandler -destination mock_ecn_handler_test.go github.com/refraction-networking/uquic/internal/ackhandler ECNHandler" type ECNHandler = ecnHandler diff --git a/internal/ackhandler/u_ackhandler.go b/internal/ackhandler/u_ackhandler.go index 8d590390..00a2a8c0 100644 --- a/internal/ackhandler/u_ackhandler.go +++ b/internal/ackhandler/u_ackhandler.go @@ -12,11 +12,12 @@ func NewUAckHandler( initialMaxDatagramSize protocol.ByteCount, rttStats *utils.RTTStats, clientAddressValidated bool, + enableECN bool, pers protocol.Perspective, - tracer logging.ConnectionTracer, + tracer *logging.ConnectionTracer, logger utils.Logger, ) (SentPacketHandler, ReceivedPacketHandler) { - sph := newSentPacketHandler(initialPacketNumber, initialMaxDatagramSize, rttStats, clientAddressValidated, pers, tracer, logger) + sph := newSentPacketHandler(initialPacketNumber, initialMaxDatagramSize, rttStats, clientAddressValidated, enableECN, pers, tracer, logger) return &uSentPacketHandler{ sentPacketHandler: sph, }, newReceivedPacketHandler(sph, rttStats, logger) diff --git a/internal/handshake/u_crypto_setup.go b/internal/handshake/u_crypto_setup.go index 92074ca8..d6dc16b1 100644 --- a/internal/handshake/u_crypto_setup.go +++ b/internal/handshake/u_crypto_setup.go @@ -34,7 +34,7 @@ type uCryptoSetup struct { rttStats *utils.RTTStats - tracer logging.ConnectionTracer + tracer *logging.ConnectionTracer logger utils.Logger perspective protocol.Perspective @@ -69,7 +69,7 @@ func NewUCryptoSetupClient( tlsConf *tls.Config, enable0RTT bool, rttStats *utils.RTTStats, - tracer logging.ConnectionTracer, + tracer *logging.ConnectionTracer, logger utils.Logger, version protocol.VersionNumber, chs *tls.ClientHelloSpec, @@ -100,7 +100,7 @@ func newUCryptoSetup( connID protocol.ConnectionID, tp *wire.TransportParameters, rttStats *utils.RTTStats, - tracer logging.ConnectionTracer, + tracer *logging.ConnectionTracer, logger utils.Logger, perspective protocol.Perspective, version protocol.VersionNumber, diff --git a/internal/mocks/logging/mockgen.go b/internal/mocks/logging/mockgen.go index 8bf08dc8..a4a7f4f0 100644 --- a/internal/mocks/logging/mockgen.go +++ b/internal/mocks/logging/mockgen.go @@ -6,17 +6,17 @@ import ( "net" "time" - "github.com/quic-go/quic-go/logging" + "github.com/refraction-networking/uquic/logging" ) -//go:generate sh -c "go run go.uber.org/mock/mockgen -build_flags=\"-tags=gomock\" -package internal -destination internal/tracer.go github.com/quic-go/quic-go/internal/mocks/logging Tracer" +//go:generate sh -c "go run go.uber.org/mock/mockgen -build_flags=\"-tags=gomock\" -package internal -destination internal/tracer.go github.com/refraction-networking/uquic/internal/mocks/logging Tracer" type Tracer interface { SentPacket(net.Addr, *logging.Header, logging.ByteCount, []logging.Frame) SentVersionNegotiationPacket(_ net.Addr, dest, src logging.ArbitraryLenConnectionID, _ []logging.VersionNumber) DroppedPacket(net.Addr, logging.PacketType, logging.ByteCount, logging.PacketDropReason) } -//go:generate sh -c "go run go.uber.org/mock/mockgen -build_flags=\"-tags=gomock\" -package internal -destination internal/connection_tracer.go github.com/quic-go/quic-go/internal/mocks/logging ConnectionTracer" +//go:generate sh -c "go run go.uber.org/mock/mockgen -build_flags=\"-tags=gomock\" -package internal -destination internal/connection_tracer.go github.com/refraction-networking/uquic/internal/mocks/logging ConnectionTracer" type ConnectionTracer interface { StartedConnection(local, remote net.Addr, srcConnID, destConnID logging.ConnectionID) NegotiatedVersion(chosen logging.VersionNumber, clientVersions, serverVersions []logging.VersionNumber) diff --git a/internal/utils/log_test.go b/internal/utils/log_test.go index 98b513d4..4be75dff 100644 --- a/internal/utils/log_test.go +++ b/internal/utils/log_test.go @@ -82,7 +82,7 @@ var _ = Describe("Log", func() { DefaultLogger.Infof("info") t, err := time.Parse(format, b.String()[:b.Len()-6]) Expect(err).ToNot(HaveOccurred()) - Expect(t).To(BeTemporally("~", time.Now(), 25*time.Hour)) + Expect(t).To(BeTemporally("~", time.Now(), 48*time.Hour)) }) It("says whether debug is enabled", func() { diff --git a/mock_batch_conn_test.go b/mock_batch_conn_test.go index 1ecc4265..7d331957 100644 --- a/mock_batch_conn_test.go +++ b/mock_batch_conn_test.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package quic -self_package github.com/quic-go/quic-go -source sys_conn_oob.go -destination mock_batch_conn_test.go -mock_names batchConn=MockBatchConn +// mockgen -package quic -self_package github.com/refraction-networking/uquic -source sys_conn_oob.go -destination mock_batch_conn_test.go -mock_names batchConn=MockBatchConn // // Package quic is a generated GoMock package. package quic diff --git a/mock_packetconn_test.go b/mock_packetconn_test.go index f148bb32..6e317e3e 100644 --- a/mock_packetconn_test.go +++ b/mock_packetconn_test.go @@ -3,7 +3,7 @@ // // Generated by this command: // -// mockgen -package quic -self_package github.com/quic-go/quic-go -self_package github.com/quic-go/quic-go -destination mock_packetconn_test.go net PacketConn +// mockgen -package quic -self_package github.com/refraction-networking/uquic -self_package github.com/refraction-networking/uquic -destination mock_packetconn_test.go net PacketConn // // Package quic is a generated GoMock package. package quic diff --git a/mock_raw_conn_test.go b/mock_raw_conn_test.go index bf4751d9..f7862c62 100644 --- a/mock_raw_conn_test.go +++ b/mock_raw_conn_test.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/quic-go/quic-go (interfaces: RawConn) +// Source: github.com/refraction-networking/uquic (interfaces: RawConn) // // Generated by this command: // -// mockgen -build_flags=-tags=gomock -package quic -self_package github.com/quic-go/quic-go -destination mock_raw_conn_test.go github.com/quic-go/quic-go RawConn +// mockgen -build_flags=-tags=gomock -package quic -self_package github.com/refraction-networking/uquic -destination mock_raw_conn_test.go github.com/refraction-networking/uquic RawConn // // Package quic is a generated GoMock package. package quic @@ -13,7 +13,7 @@ import ( reflect "reflect" time "time" - protocol "github.com/quic-go/quic-go/internal/protocol" + protocol "github.com/refraction-networking/uquic/internal/protocol" gomock "go.uber.org/mock/gomock" ) diff --git a/u_connection.go b/u_connection.go index dc118bc6..7c11749c 100644 --- a/u_connection.go +++ b/u_connection.go @@ -24,7 +24,7 @@ var newUClientConnection = func( initialPacketNumber protocol.PacketNumber, enable0RTT bool, hasNegotiatedVersion bool, - tracer logging.ConnectionTracer, + tracer *logging.ConnectionTracer, tracingID uint64, logger utils.Logger, v protocol.VersionNumber, @@ -67,11 +67,12 @@ var newUClientConnection = func( ) s.preSetup() s.ctx, s.ctxCancel = context.WithCancelCause(context.WithValue(context.Background(), ConnectionTracingKey, tracingID)) - s.sentPacketHandler, s.receivedPacketHandler = ackhandler.NewUAckHandler( // [UQUIC] + s.sentPacketHandler, s.receivedPacketHandler = ackhandler.NewUAckHandler( initialPacketNumber, getMaxPacketSize(s.conn.RemoteAddr()), s.rttStats, - false, /* has no effect */ + false, // has no effect + s.conn.capabilities().ECN, s.perspective, s.tracer, s.logger, @@ -82,7 +83,7 @@ var newUClientConnection = func( } s.mtuDiscoverer = newMTUDiscoverer(s.rttStats, getMaxPacketSize(s.conn.RemoteAddr()), s.sentPacketHandler.SetMaxDatagramSize) - oneRTTStream := newCryptoStream(true) + oneRTTStream := newCryptoStream() var params *wire.TransportParameters @@ -134,8 +135,7 @@ var newUClientConnection = func( params.MaxDatagramFrameSize = protocol.InvalidByteCount } } - - if s.tracer != nil { + if s.tracer != nil && s.tracer.SentTransportParameters != nil { s.tracer.SentTransportParameters(params) } cs := handshake.NewUCryptoSetupClient(