th5/_dev/mint/mint-client.go

42 lines
677 B
Go
Raw Normal View History

package main
import (
"log"
"net"
"net/http"
"os"
"github.com/bifurcation/mint"
)
func main() {
2016-11-30 01:00:17 +00:00
c := &mint.Config{
PSKs: &mint.PSKMapCache{},
}
tr := &http.Transport{
DialTLS: func(network, addr string) (net.Conn, error) {
2016-11-30 01:00:17 +00:00
return mint.Dial(network, addr, c)
},
DisableKeepAlives: true,
}
client := &http.Client{Transport: tr}
resp, err := client.Get("https://" + os.Args[1])
if err != nil {
log.Fatal(err)
}
if err := resp.Write(os.Stdout); err != nil {
log.Fatal(err)
}
// Resumption
resp, err = client.Get("https://" + os.Args[1])
if err != nil {
log.Fatal(err)
}
if err := resp.Write(os.Stdout); err != nil {
log.Fatal(err)
}
}