// 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.Client(tcpConn, &tlsConfig, utls.HelloCustom)
clientHelloSpec := tls.ClientHelloSpec {
CipherSuites: []uint16{
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
0x0039,
0x0038,
0x0037,
0x0036,
0x0088,
0x0087,
0x0086,
0x0085,
0xc019,
0x003a,
0x0089,
0xc00f,
0xc005,
tls.TLS_RSA_WITH_AES_256_CBC_SHA,
0x0084,
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
0x0033,
0x0032,
0x0031,
0x0030,
0x009a,
0x0099,
0x0098,
0x0097,
0x0045,
0x0044,
0x0043,
0x0042,
0xc018,
0x0034,
0x009b,
0x0046,
0xc00e,
0xc004,
tls.TLS_RSA_WITH_AES_128_CBC_SHA,
0x0096,
0x0041,
0x0007,
tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA,
tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
0xc016,
0x0018,
0xc00c,
0xc002,
tls.TLS_RSA_WITH_RC4_128_SHA,
0x0004,
tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
0xc008,
0x0016,
0x0013,
0x0010,
0x000d,
0xc017,
0x001b,
0xc00d,
0xc003,
tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
0x0015,
0x0012,
0x000f,
0x000c,
0x001a,
0x0009,
0x0014,
0x0011,
0x0019,
0x0008,
0x0006,
0x0017,
0x0003,
0x00ff,
},
CompressionMethods: []byte{
0x01
0x00, // compressionNone
},
Extensions: []tls.TLSExtension{
code generation error: short sig_algs },
}
tlsConn.ApplyPreset(clientHelloSpec)
n, err = tlsConn.Write("Hello, World!")
// or tlsConn.Handshake() for better control