-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhttp3client.go
More file actions
33 lines (30 loc) · 656 Bytes
/
http3client.go
File metadata and controls
33 lines (30 loc) · 656 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package PipelineHttp
import (
"crypto/tls"
"crypto/x509"
"github.com/quic-go/quic-go/http3"
"log"
"net/http"
)
// 在线测试http3 https://geekflare.com/tools/http3-test
func (r *PipelineHttp) GetTransport4Http3() http.RoundTripper {
pool, err := x509.SystemCertPool()
if nil != err {
log.Println(err)
return nil
}
var tr = &http3.RoundTripper{
DisableCompression: false,
TLSClientConfig: &tls.Config{
RootCAs: pool,
InsecureSkipVerify: true,
},
}
return tr
}
// get http3 client
func (r *PipelineHttp) GetClient4Http3() *http.Client {
r.Client = r.GetClient(r.GetTransport4Http3())
r.ver = 3
return r.Client
}