mirror of
https://github.com/fumiama/terasu-cloudflared.git
synced 2026-06-28 08:00:26 +08:00
feat: embed terasu inside
This commit is contained in:
18
vendor/golang.org/x/net/http2/transport.go
generated
vendored
18
vendor/golang.org/x/net/http2/transport.go
generated
vendored
@@ -31,6 +31,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/fumiama/terasu"
|
||||
"golang.org/x/net/http/httpguts"
|
||||
"golang.org/x/net/http2/hpack"
|
||||
"golang.org/x/net/idna"
|
||||
@@ -3275,13 +3276,22 @@ func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.M
|
||||
// dialTLSWithContext uses tls.Dialer, added in Go 1.15, to open a TLS
|
||||
// connection.
|
||||
func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) {
|
||||
dialer := &tls.Dialer{
|
||||
Config: cfg,
|
||||
}
|
||||
dialer := &net.Dialer{}
|
||||
cn, err := dialer.DialContext(ctx, network, addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tlsCn := cn.(*tls.Conn) // DialContext comment promises this will always succeed
|
||||
tlsCn := tls.Client(terasu.NewConn(cn), cfg)
|
||||
if deadline, ok := ctx.Deadline(); ok {
|
||||
cn.SetDeadline(deadline)
|
||||
}
|
||||
err = tlsCn.Handshake()
|
||||
if _, ok := ctx.Deadline(); ok {
|
||||
cn.SetDeadline(time.Time{})
|
||||
}
|
||||
if err != nil {
|
||||
cn.Close()
|
||||
return nil, err
|
||||
}
|
||||
return tlsCn, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user