mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
update client.go http1.1 => http2
This commit is contained in:
parent
5b3e3cd2be
commit
451ddecbd7
1 changed files with 14 additions and 0 deletions
|
|
@ -18,9 +18,12 @@ package rpc
|
|||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"reflect"
|
||||
|
|
@ -197,6 +200,17 @@ func DialOptions(ctx context.Context, rawurl string, options ...ClientOption) (*
|
|||
}
|
||||
|
||||
cfg := new(clientConfig)
|
||||
tr := &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // İsteğe bağlı, güvenlik önlemleri gerektiğinde uygun şekilde ayarlayın
|
||||
ForceAttemptHTTP2: true, // !!!note: bu kısmı eklersen HTTP/2'yi etkinleştirirsin eklemezsende default olarak http1.1 çalışır
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 30 * time.Second, // Bağlantı süresi aşılması durumunda zaman aşımı
|
||||
KeepAlive: 30 * time.Second, // Keep-alive süresi
|
||||
DualStack: true, // İstemci IPv4/IPv6 desteği
|
||||
}).DialContext,
|
||||
}
|
||||
cfg.httpClient = &http.Client{Transport: tr}
|
||||
|
||||
for _, opt := range options {
|
||||
opt.applyOption(cfg)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue