github.com/alejandroesc/spdy@v0.0.0-20200317064415-01a02f0eb389/examples/proxy_client/proxy_client.go (about)

     1  // Copyright 2014 Jamie Hall. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"crypto/tls"
     9  	"net/http"
    10  
    11  	"github.com/SlyMarbo/spdy"
    12  )
    13  
    14  func handle(err error) {
    15  	if err != nil {
    16  		panic(err)
    17  	}
    18  }
    19  
    20  func serveHTTP(w http.ResponseWriter, r *http.Request) {
    21  	w.Write([]byte("Testing, testing, 1, 2, 3."))
    22  }
    23  
    24  func main() {
    25  	http.HandleFunc("/", serveHTTP)
    26  	handle(spdy.ConnectAndServe("http://localhost:8080/", &tls.Config{InsecureSkipVerify: true}, nil))
    27  }