diff --git a/.github/workflows/go_1_20.yml b/.github/workflows/go.yml similarity index 53% rename from .github/workflows/go_1_20.yml rename to .github/workflows/go.yml index 4649b225..76c02822 100644 --- a/.github/workflows/go_1_20.yml +++ b/.github/workflows/go.yml @@ -1,7 +1,7 @@ # This workflow will build a golang project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go -name: "Go 1.20" +name: "Go" on: push: @@ -10,18 +10,20 @@ on: branches: [ "master" ] jobs: - go_build_test: - runs-on: ubuntu-latest + build: + strategy: + fail-fast: false + matrix: + os: [ "ubuntu-latest", "windows-latest", "macos-latest" ] + go: [ "1.20.x", "1.21.0" ] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v4 + - uses: actions/setup-go@v4 with: - go-version: '1.20.7' - + go-version: ${{ matrix.go }} + - run: go version - name: Build run: go build -v ./... - - name: Test - run: go test -v ./... + run: go test -v ./... \ No newline at end of file diff --git a/.github/workflows/go_1_21.yml b/.github/workflows/go_1_21.yml deleted file mode 100644 index 822643ac..00000000 --- a/.github/workflows/go_1_21.yml +++ /dev/null @@ -1,27 +0,0 @@ -# This workflow will build a golang project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go - -name: "Go 1.21" - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - go_build_test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.21.0-rc.4' - - - name: Build - run: go build -v ./... - - - name: Test - run: go test -v ./... diff --git a/README.md b/README.md index fa247ebf..8079da48 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # ![uTLS](logo_small.png) uTLS -[![Build Status](https://github.com/refraction-networking/utls/actions/workflows/go_1_20.yml/badge.svg?branch=master)](https://github.com/refraction-networking/utls/actions/workflows/go_1_20.yml) -[![Build Status](https://github.com/refraction-networking/utls/actions/workflows/go_1_21.yml/badge.svg?branch=master)](https://github.com/refraction-networking/utls/actions/workflows/go_1_21.yml) +[![Build Status](https://github.com/refraction-networking/utls/actions/workflows/go.yml/badge.svg?branch=master)](https://github.com/refraction-networking/utls/actions/workflows/go.yml) [![godoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/refraction-networking/utls#UConn) --- uTLS is a fork of "crypto/tls", which provides ClientHello fingerprinting resistance, low-level access to handshake, fake session tickets and some other features. Handshake is still performed by "crypto/tls", this library merely changes ClientHello part of it and provides low-level access. diff --git a/quic.go b/quic.go index 6cb10df8..286302f0 100644 --- a/quic.go +++ b/quic.go @@ -246,10 +246,15 @@ func (q *QUICConn) HandleData(level QUICEncryptionLevel, data []byte) error { return nil } +type QUICSessionTicketOptions struct { + // EarlyData specifies whether the ticket may be used for 0-RTT. + EarlyData bool +} + // SendSessionTicket sends a session ticket to the client. // It produces connection events, which may be read with NextEvent. // Currently, it can only be called once. -func (q *QUICConn) SendSessionTicket(earlyData bool) error { +func (q *QUICConn) SendSessionTicket(opts QUICSessionTicketOptions) error { c := q.conn if !c.isHandshakeComplete.Load() { return quicError(errors.New("tls: SendSessionTicket called before handshake completed")) @@ -261,7 +266,7 @@ func (q *QUICConn) SendSessionTicket(earlyData bool) error { return quicError(errors.New("tls: SendSessionTicket called multiple times")) } q.sessionTicketSent = true - return quicError(c.sendSessionTicket(earlyData)) + return quicError(c.sendSessionTicket(opts.EarlyData)) } // ConnectionState returns basic TLS details about the connection. diff --git a/quic_test.go b/quic_test.go index 02503cff..9a29fa56 100644 --- a/quic_test.go +++ b/quic_test.go @@ -125,7 +125,8 @@ func runTestQUICConnection(ctx context.Context, cli, srv *testQUICConn, onHandle case QUICHandshakeDone: a.complete = true if a == srv { - if err := srv.conn.SendSessionTicket(false); err != nil { + opts := QUICSessionTicketOptions{} + if err := srv.conn.SendSessionTicket(opts); err != nil { return err } }