Skip to content

Commit

Permalink
bump quic-go version for quic-in-quic capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
francoismichel committed Jan 3, 2024
1 parent 901fe6d commit c26b1e5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
8 changes: 4 additions & 4 deletions conversation.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Conversation struct {
maxPacketSize uint64
defaultDatagramsQueueSize uint64
streamCreator http3.StreamCreator
messageSender util.MessageSender
messageSender util.DatagramSender
channelsManager *channelsManager
context context.Context
cancelContext context.CancelCauseFunc
Expand Down Expand Up @@ -134,7 +134,7 @@ func (c *Conversation) EstablishClientConversation(req *http.Request, roundTripp
// currently does not work for several conversations in the same QUIC connection

for {
dgram, err := qconn.ReceiveMessage(c.Context())
dgram, err := qconn.ReceiveDatagram(c.Context())
if err != nil {
if err != context.Canceled {
log.Error().Msgf("could not receive message from conn: %s", err)
Expand Down Expand Up @@ -166,7 +166,7 @@ func (c *Conversation) EstablishClientConversation(req *http.Request, roundTripp
}
}

func NewServerConversation(ctx context.Context, controlStream http3.Stream, qconn quic.Connection, messageSender util.MessageSender, maxPacketsize uint64) (*Conversation, error) {
func NewServerConversation(ctx context.Context, controlStream http3.Stream, qconn quic.Connection, messageSender util.DatagramSender, maxPacketsize uint64) (*Conversation, error) {
backgroundContext, backgroundCancelFunc := context.WithCancelCause(ctx)

tls := qconn.ConnectionState().TLS
Expand Down Expand Up @@ -290,7 +290,7 @@ func (c *Conversation) getDatagramSenderForChannel(channelID util.ChannelID) fun
buf := util.AppendVarInt(nil, uint64(c.controlStream.StreamID()))
buf = util.AppendVarInt(buf, channelID)
buf = append(buf, datagram...)
return c.messageSender.SendMessage(buf)
return c.messageSender.SendDatagram(buf)
}
}

Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/kevinburke/ssh_config v1.2.0
github.com/onsi/ginkgo/v2 v2.13.0
github.com/onsi/gomega v1.29.0
github.com/quic-go/quic-go v0.38.1
github.com/quic-go/quic-go v0.40.1-0.20240102075208-1083d1fb8f98
github.com/rs/zerolog v1.31.0
golang.org/x/crypto v0.14.0
golang.org/x/oauth2 v0.13.0
Expand All @@ -27,6 +27,7 @@ require (
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-20 v0.3.3 // indirect
go.uber.org/mock v0.3.0 // indirect
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ github.com/quic-go/qtls-go1-20 v0.3.3 h1:17/glZSLI9P9fDAeyCHBFSWSqJcwx1byhLwP5eU
github.com/quic-go/qtls-go1-20 v0.3.3/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
github.com/quic-go/quic-go v0.38.1 h1:M36YWA5dEhEeT+slOu/SwMEucbYd0YFidxG3KlGPZaE=
github.com/quic-go/quic-go v0.38.1/go.mod h1:ijnZM7JsFIkp4cRyjxJNIzdSfCLmUMg9wdyhGmg+SN4=
github.com/quic-go/quic-go v0.40.1-0.20240102075208-1083d1fb8f98 h1:XSdekoU+UVlq/Mav+6dYyPuyy5+qzDa/TglBVi+L7Rs=
github.com/quic-go/quic-go v0.40.1-0.20240102075208-1083d1fb8f98/go.mod h1:qCkNjqczPEvgsOnxZ0eCD14lv+B2LHlFAB++CNOh9hA=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
Expand All @@ -68,6 +70,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo=
go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (s *Server) GetHTTPHandlerFunc(ctx context.Context) AuthenticatedHandlerFun
// TODO: this hijacks the datagrams for the whole quic connection, so the server
// currently does not work for several conversations in the same QUIC connection
for {
dgram, err := qconn.ReceiveMessage(ctx)
dgram, err := qconn.ReceiveDatagram(ctx)
if err != nil {
if !errors.Is(err, context.Canceled) && !errors.Is(err, net.ErrClosed) {
log.Error().Msgf("could not receive message from conn: %s", err)
Expand Down
4 changes: 2 additions & 2 deletions util/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ func (b *BytesReadCloser) Close() error { return nil }
// sends an ssh3 datagram. The function must know the ID of the channel
type SSH3DatagramSenderFunc func(p []byte) error

type MessageSender interface {
SendMessage(p []byte) error
type DatagramSender interface {
SendDatagram(p []byte) error
}

0 comments on commit c26b1e5

Please sign in to comment.