Skip to content

Instantly share code, notes, and snippets.

@josephspurrier josephspurrier/proxy.go
Last active Oct 3, 2018

Embed
What would you like to do?
Proxy Testing in Go
package main
import (
"log"
"net/http"
"os"
)
func main() {
os.Setenv("HTTP_PROXY", "127.0.0.1:80")
os.Setenv("HTTPS_PROXY", "127.0.0.1:80")
os.Setenv("NO_PROXY", ".google.com")
_, err := http.Get("http://www.google.com")
if err != nil {
log.Println("Error")
} else {
log.Println("Success")
}
_, err = http.Get("https://www.google.com")
if err != nil {
log.Println("Error")
} else {
log.Println("Success")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.