Last active
January 11, 2023 14:34
-
-
Save magisterquis/a07f57669861a9fb97a4a4ecf074a25e to your computer and use it in GitHub Desktop.
Domain fronting in Go
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 ( | |
"crypto/tls" | |
"fmt" | |
"log" | |
"net/http" | |
"net/http/httputil" | |
) | |
func main() { | |
/* Domain-fronted request */ | |
res, err := (&http.Client{ | |
Transport: &http.Transport{ | |
TLSClientConfig: &tls.Config{ | |
ServerName: "youtube.com", | |
}, | |
}, | |
}).Get("https://dns.google.com/resolve?name=example.com&type=A") /* Turned off by google :( */ | |
if nil != err { | |
log.Fatalf("GET: %v", err) | |
} | |
/* Print response */ | |
o, err := httputil.DumpResponse(res, true) | |
if nil != err { | |
log.Fatalf("Dump: %v", err) | |
} | |
fmt.Printf("%s\n", o) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment