Skip to content

Commit

Permalink
fix: connection doesn't allow setting of receive buffer size. Not a *…
Browse files Browse the repository at this point in the history
…net.UDPConn?.
  • Loading branch information
YUNRU committed Jul 17, 2024
1 parent 474bf46 commit 7f3eeb4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion transport/internet/splithttp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (c *DefaultDialerClient) SendUploadRequest(ctx context.Context, url string,
}
req.Header = c.transportConfig.GetRequestHeader()

if c.isH2 {
if c.isH2 || c.isH3 {
resp, err := c.upload.Do(req)
if err != nil {
return err
Expand Down
7 changes: 4 additions & 3 deletions transport/internet/splithttp/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ func getHTTPClient(ctx context.Context, dest net.Destination, streamSettings *in
var uploadTransport http.RoundTripper

if isH3 {
dest.Network = net.Network_UDP
quicConfig := &quic.Config{
HandshakeIdleTimeout: 10 * time.Second,
MaxIdleTimeout: 90 * time.Second,
KeepAlivePeriod: 3 * time.Second,
Allow0RTT: true,
}
dest.Network = net.Network_UDP
roundTripper := &http3.RoundTripper{
TLSClientConfig: gotlsConfig,
QUICConfig: quicConfig,
Expand All @@ -100,11 +101,11 @@ func getHTTPClient(ctx context.Context, dest net.Destination, streamSettings *in
if err != nil {
return nil, err
}
udpAddr,err := net.ResolveUDPAddr("udp",conn.RemoteAddr().String())
udpAddr, err := net.ResolveUDPAddr("udp", conn.RemoteAddr().String())
if err != nil {
return nil, err
}
return quic.DialEarly(ctx, conn.(net.PacketConn), udpAddr, tlsCfg, cfg)
return quic.DialEarly(ctx, conn.(*internet.PacketConnWrapper).Conn.(*net.UDPConn), udpAddr, tlsCfg, cfg)
},
}
downloadTransport = roundTripper
Expand Down

0 comments on commit 7f3eeb4

Please sign in to comment.