// import tls "github.com/refraction-networking/utls"
tcpConn, err := net.Dial("tcp", "tlsfingerprint.io:443")
if err != nil {
fmt.Printf("net.Dial() failed: %+v\n", err)
return
}
config := tls.Config{ServerName: "tlsfingerprint.io"}
// This fingerprint includes feature(s), not fully supported by TLS.
// uTLS client with this fingerprint will only be able to to talk to servers,
// that also do not support those features.
tlsConn := tls.UClient(tcpConn, &tlsConfig, tls.HelloCustom)
clientHelloSpec := tls.ClientHelloSpec {
CipherSuites: []uint16{
0x0021,
0x0024,
0x0020,
0x0000,
0xc0aa,
0xc0ab,
0x008b,
0x008c,
0x00ae,
0xc0a4,
0xc0a8,
0x00a8,
0x008d,
0x00af,
0xc0a5,
0xc0a9,
0x00a9,
0xc064,
0xc06a,
0xc065,
0xc06b,
0xc094,
0xc08e,
0xc095,
0xc08f,
0xccab,
0x002c,
0x00b0,
0x00b1,
0x008a,
0x0062,
0x0061,
0x0060,
0x0064,
0x0008,
0x0006,
0x0003,
0x0093,
0x0094,
0x00b6,
0x00ac,
0x0095,
0x00b7,
0x00ad,
0xc068,
0xc06e,
0xc069,
0xc06f,
0xc098,
0xc092,
0xc099,
0xc093,
0xccae,
0x002e,
0x00b8,
0x00b9,
0x0092,
0x007c,
},
CompressionMethods: []byte{
0x00, // compressionNone
},
Extensions: []tls.TLSExtension{
&tls.SupportedPointsExtension{SupportedPoints: []byte{
0x00, // pointFormatUncompressed
}},
&tls.SupportedCurvesExtension{[]tls.CurveID{
tls.CurveP256,
tls.CurveP384,
tls.CurveP521,
tls.X25519,
0x0100,
}},
&tls.SNIExtension{},
&tls.SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: []tls.SignatureScheme{
0x0101,
tls.PKCS1WithSHA1,
0x0301,
tls.PKCS1WithSHA256,
0x0402,
tls.ECDSAWithP256AndSHA256,
0x0407,
0x0408,
tls.PKCS1WithSHA512,
0x0602,
tls.ECDSAWithP521AndSHA512,
0x0607,
0x0608,
},},
},
}
tlsConn.ApplyPreset(&clientHelloSpec)
n, err = tlsConn.Write([]byte("Hello, World!"))
// or tlsConn.Handshake() for better control