Created
February 12, 2019 09:00
-
-
Save solmonk/5a7daab1b293dada2786592acab41371 to your computer and use it in GitHub Desktop.
_
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" | |
"fmt" | |
"os" | |
) | |
func dial(addr string, conf *tls.Config) { | |
c, err := tls.Dial("tcp", addr+":443", conf) | |
if err != nil { | |
fmt.Println(err.Error()) | |
return | |
} | |
if err := c.Handshake(); err != nil { | |
fmt.Println(err.Error()) | |
} | |
fmt.Println("success") | |
} | |
func main() { | |
var addr = os.Args[1] | |
var fake = os.Args[2] | |
fmt.Println("dialing to: ", addr) | |
fmt.Println("indication: ", fake) | |
conf := &tls.Config{ | |
ServerName: fake, | |
InsecureSkipVerify: true, | |
} | |
println("Dialing with 4 curves") | |
dial(addr, conf) | |
var pref []tls.CurveID | |
for i := 0; i < 1000; i++ { | |
pref = append(pref, tls.CurveP256) | |
} | |
conf.CurvePreferences = pref | |
println("Dialing with 1000 curves") | |
dial(addr, conf) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment