add sniffer utility
This commit is contained in:
@@ -93,7 +93,7 @@ func (d *h2Dialer) Dial(ctx context.Context, address string, opts ...dialer.Dial
|
||||
if d.h2c {
|
||||
client.Transport = &http2.Transport{
|
||||
AllowHTTP: true,
|
||||
DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {
|
||||
DialTLSContext: func(ctx context.Context, network, addr string, cfg *tls.Config) (net.Conn, error) {
|
||||
return options.Dialer.Dial(ctx, network, addr)
|
||||
},
|
||||
}
|
||||
@@ -126,14 +126,11 @@ func (d *h2Dialer) Dial(ctx context.Context, address string, opts ...dialer.Dial
|
||||
}
|
||||
pr, pw := io.Pipe()
|
||||
req := &http.Request{
|
||||
Method: http.MethodConnect,
|
||||
URL: &url.URL{Scheme: scheme, Host: host},
|
||||
Header: d.md.header,
|
||||
ProtoMajor: 2,
|
||||
ProtoMinor: 0,
|
||||
Body: pr,
|
||||
Host: host,
|
||||
// ContentLength: -1,
|
||||
Method: http.MethodConnect,
|
||||
URL: &url.URL{Scheme: scheme, Host: host},
|
||||
Header: d.md.header,
|
||||
Body: pr,
|
||||
Host: host,
|
||||
}
|
||||
if req.Header == nil {
|
||||
req.Header = make(http.Header)
|
||||
|
||||
Reference in New Issue
Block a user