Created
December 10, 2014 13:50
-
-
Save justinrolston/d0aaeb0991d6b780da75 to your computer and use it in GitHub Desktop.
working proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"github.com/elazarl/goproxy" | |
) | |
func main() { | |
proxy := goproxy.NewProxyHttpServer() | |
proxy.OnRequest().DoFunc( | |
func(r *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) { | |
nreq, _ := http.NewRequest("GET", "http://github.com", nil) | |
r.RequestURI = "http://github.com" | |
fmt.Println("------------") | |
fmt.Println(r.RequestURI) | |
return nreq, nil | |
}) | |
log.Fatalln(http.ListenAndServe(":8080", proxy)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment