Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Go 1.6 and HTTP/2

Go 1.6 and HTTP/2

It Just Works*

Nathan Youngman

February 22, 2016
Tweet

More Decks by Nathan Youngman

Other Decks in Programming

Transcript

  1. Configure Transport transport := &http.Transport{}
 err := http2.ConfigureTransport(transport)
 if err

    != nil {
 log.Fatal(err)
 }
 client := &http.Client{Transport: transport}
 
 response, err := client.Get("https:// http2.golang.org/reqinfo")
  2. Custom Cert func NewClient(cert tls.Certificate) (*http.Client, error) {
 config :=

    &tls.Config{
 Certificates: []tls.Certificate{cert},
 }
 config.BuildNameToCertificate()
 transport := &http.Transport{TLSClientConfig: config}
 
 if err := http2.ConfigureTransport(transport); err != nil {
 return nil, err
 }
 
 return &http.Client{Transport: transport}, nil
 }