Tr:=http2. Transport {}
CConn, err:=tr. NewClientConn (conn)
if err ! Nil={
Return nil, err
}
CConn. RoundTrip (the req)
I'd like to leave this code proxy server, how to set? Conveniently ignore all certificate
Http1.1 can walk agent I write so
HTTP proxy:=func (_ *. Request) (* url in the url, the error) {
The return url. Parse (" http://127.0.0.1:8080 ")
}
Tr:=& amp; HTTP. Transport {
TLSClientConfig: & amp; The TLS. Config {InsecureSkipVerify: true},
//ignore certificateProxy: the Proxy,//set agent
}
Client:=& amp; . The HTTP Client {Transport: tr}
/////////////////////////////////
//////////////
Urltmp:="https://m.facebook.com"
Resp, err:=client. Get (urltmp)
CodePudding user response:
TryTr:=& amp; HTTP. Transport {
TLSClientConfig: & amp; The TLS. Config {InsecureSkipVerify: true},
//ignore certificateProxy: the Proxy,//set agent
}
//err:=http2 ConfigureTransport (tr)
Tr2:=& amp; Http2. Transport {}
Tr2. T1=tr//to use reflection to set here, the reflection is not introduced in detail, refer to the API reflect yourself