Created
June 3, 2016 19:41
-
-
Save sthorne/a2de3986a297519b9010696762c6f811 to your computer and use it in GitHub Desktop.
Fetch an HTTPS Asset from Specific IP and Skipping DNS lookup
This file contains 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 ( | |
"crypto/tls" | |
"log" | |
"net/http" | |
) | |
func main() { | |
tlsConfig := &tls.Config{ | |
ServerName: "moupon.co", | |
} | |
tlsConfig.BuildNameToCertificate() | |
transport := &http.Transport{TLSClientConfig: tlsConfig} | |
client := &http.Client{Transport: transport} | |
req, err := http.NewRequest("GET", "https://216.239.32.21/s/img/logo.png", nil) | |
if err != nil { | |
log.Fatal(err) | |
} | |
req.Host = "moupon.co" | |
_, err = client.Do(req) | |
if err != nil { | |
log.Fatal(err) | |
} | |
log.Fatal("no errors") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment