// 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{
0xc037,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
0x00b2,
0x0067,
0xc09a,
0xc096,
0xc076,
0xc072,
0xc066,
0xc04c,
0xc048,
0xc044,
0x00be,
0xc036,
0xc035,
0xc021,
0xc01e,
tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
0x0091,
0x0090,
0x0045,
0x0039,
0x0033,
0xc08d,
0xc08c,
0xc089,
0xc088,
0xc079,
0xc078,
0xc075,
0xc074,
0xc063,
0xc062,
0xc05f,
0xc05e,
0xc04f,
0xc04e,
0xc04b,
0xc04a,
0xc032,
0xc031,
0xc02e,
0xc02d,
0xc02a,
0xc029,
0xc026,
0xc025,
0xc00f,
0xc00e,
0xc005,
0xc004,
0xc07f,
0xc07e,
0xc055,
0xc054,
0xc041,
0xc040,
0x00c2,
0x00bc,
0x00a1,
0x00a0,
0x0086,
0x0069,
0x00ff,
},
CompressionMethods: []byte{
0x00, // compressionNone
0x01
},
Extensions: []tls.TLSExtension{
&tls.SupportedCurvesExtension{[]tls.CurveID{
0x001e,
tls.X25519,
tls.CurveP384,
tls.CurveP256,
tls.CurveP521,
0x0100,
0x0101,
0x000e,
0x000d,
0x001c,
0x000c,
0x000b,
0x001b,
0x000a,
0x0009,
0x0016,
0x001a,
0x0008,
0x0007,
0x0006,
0x0015,
0x0014,
0x0004,
0x0005,
0x0013,
0x0012,
0x0002,
0x0003,
0x0001,
0x0010,
0x0011,
0x000f,
}},
&tls.SupportedPointsExtension{SupportedPoints: []byte{
0x00, // pointFormatUncompressed
}},
&tls.SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: []SignatureScheme{
0x0808,
0x0807,
0x080b,
0x080a,
0x0809,
tls.PSSWithSHA512,
tls.PSSWithSHA384,
tls.PSSWithSHA256,
tls.ECDSAWithP521AndSHA512,
tls.ECDSAWithP384AndSHA384,
tls.ECDSAWithP256AndSHA256,
0x0303,
tls.PKCS1WithSHA512,
tls.PKCS1WithSHA384,
tls.PKCS1WithSHA256,
0x0301,
tls.ECDSAWithSHA1,
0x0202,
tls.PKCS1WithSHA1,
0x0101,
},},
&tls.GenericExtension {id: 0x0016}, // WARNING: UNKNOWN EXTENSION, USE AT YOUR OWN RISK
&tls.UtlsExtendedMasterSecretExtension{},
&tls.UtlsPaddingExtension{GetPaddingLen: BoringPaddingStyle},
},
}
tlsConn.ApplyPreset(clientHelloSpec)
n, err = tlsConn.Write("Hello, World!")
// or tlsConn.Handshake() for better control