// 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{
0x001d,
0x001c,
0xfeff,
0xfefe,
0x0063,
0x0065,
0x0011,
0x0072,
0x0013,
0x0073,
0x0032,
0x0040,
0x00a2,
0x0074,
0x0038,
0x006a,
0x00a3,
0xc042,
0xc056,
0xc043,
0xc057,
0x0044,
0x00bd,
0xc080,
0x0087,
0x00c3,
0xc081,
0x0012,
0x0066,
0x0099,
0x008f,
0x0090,
0x00b2,
0xc0a6,
0x00aa,
0x0091,
0x00b3,
0xc0a7,
0x00ab,
0xc066,
0xc06c,
0xc067,
0xc06d,
0xc096,
0xc090,
0xc097,
0xc091,
0xccad,
0x002d,
0x00b4,
0x00b5,
0x008e,
0x0014,
0x0077,
0x0016,
0x0078,
0x0033,
0x0067,
0xc09e,
0xc0a2,
0x009e,
0x0079,
0x0039,
0x006b,
},
CompressionMethods: []byte{
0x00, // compressionNone
},
Extensions: []tls.TLSExtension{
&tls.SupportedCurvesExtension{[]tls.CurveID{
tls.CurveP256,
tls.CurveP384,
tls.CurveP521,
tls.X25519,
0x0100,
}},
&tls.SupportedPointsExtension{SupportedPoints: []byte{
0x00, // pointFormatUncompressed
}},
&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