8 "go.stargrave.org/godlighty"
12 host := "some-proxied-host.com"
13 godlighty.Hosts[host] = &godlighty.HostCfg{
14 Hooks: []godlighty.Hook{
15 func(w http.ResponseWriter, r *http.Request) bool {
17 r.URL.Host = "[dead::beaf]"
20 resp, err := http.DefaultClient.Do(r)
22 fmt.Printf("%s %s \"%s %+q %s\" %d \"%s\" \"%s\"\n",
23 r.RemoteAddr, host, r.Method, godlighty.PathWithQuery(r.URL),
24 r.Proto, http.StatusBadGateway, err.Error(),
25 r.Header.Get("User-Agent"),
27 http.Error(w, err.Error(), http.StatusBadGateway)
30 for k, vs := range resp.Header {
31 for _, v := range vs {
35 w.WriteHeader(resp.StatusCode)
36 size, _ := io.Copy(w, resp.Body)
38 fmt.Printf("%s %s \"%s %+q %s\" %d %d \"%s\"\n",
39 r.RemoteAddr, host, r.Method, godlighty.PathWithQuery(r.URL),
40 r.Proto, resp.StatusCode, size,
41 r.Header.Get("User-Agent"),