// 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{
0xc022,
0xc021,
0xc020,
0x00b7,
0x00b3,
0x0091,
0xc09b,
0xc099,
0xc097,
0x00af,
0xc095,
0xc0af,
0xc0ad,
0xc0a3,
0xc09f,
0xc019,
0x00a7,
0x006d,
0x003a,
0x00c5,
0x0089,
0x00ad,
0x00ab,
0xccae,
0xccad,
0xccac,
0xc0ab,
0xc0a7,
0xc0a1,
0xc09d,
0x00a9,
0xccab,
0xc0a9,
0xc0a5,
0xc038,
0xc036,
0x0095,
0x008d,
0xff00,
0xff01,
0xff02,
0xff03,
0xff85,
0xc01f,
0xc01e,
0xc01d,
0xc0ae,
0xc0ac,
0xc0a2,
0xc09e,
0x00ac,
0x00aa,
0xc0aa,
0xc0a6,
0xc0a0,
0xc09c,
0x00a8,
0xc0a8,
0xc0a4,
0xc018,
0x00a6,
0x006c,
0x0034,
0x00bf,
0x009b,
0x0046,
0xc037,
0xc035,
0x00b6,
0x00b2,
0x0090,
0xc09a,
0xc098,
0xc096,
0x00ae,
0xc094,
0x0094,
0x008c,
0x0021,
0x0025,
0xc016,
0x0018,
0x0092,
0x008a,
0x0020,
0x0024,
0xc033,
0x008e,
0xc01c,
0xc01b,
0xc01a,
0xc017,
0x001b,
0x0093,
0x008b,
0x001f,
0x0023,
0xc034,
0x008f,
0x001a,
0x0061,
0x0060,
0x0019,
0x0006,
0x000b,
0x000e,
0x0017,
0xc010,
0xc006,
0xc015,
0xc00b,
0xc001,
0xc03b,
0xc03a,
0xc039,
0x00b9,
0x00b8,
0x00b5,
0x00b4,
0x002e,
0x002d,
0x00b1,
0x00b0,
0x002c,
0x003b,
0x0002,
0x0001,
0x00ff,
},
CompressionMethods: []byte{
0x00, // compressionNone
},
Extensions: []tls.TLSExtension{
&tls.SNIExtension{},
&tls.SessionTicketExtension{},
&tls.NPNExtension{},
&tls.SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: []tls.SignatureScheme{
tls.PKCS1WithSHA512,
0x0602,
tls.ECDSAWithP521AndSHA512,
tls.PKCS1WithSHA384,
0x0502,
tls.ECDSAWithP384AndSHA384,
tls.PKCS1WithSHA256,
0x0402,
tls.ECDSAWithP256AndSHA256,
0x0301,
0x0302,
0x0303,
tls.PKCS1WithSHA1,
0x0202,
tls.ECDSAWithSHA1,
},},
&tls.SupportedCurvesExtension{[]tls.CurveID{
0x000e,
0x000d,
tls.CurveP521,
0x001c,
0x001e,
0x000b,
0x000c,
0x001b,
tls.CurveP384,
0x0009,
0x000a,
0x001a,
0x0016,
tls.CurveP256,
tls.X25519,
0x0008,
0x0006,
0x0007,
0x0014,
0x0015,
0x0004,
0x0005,
0x0012,
0x0013,
0x0001,
0x0002,
0x0003,
0x000f,
0x0010,
0x0011,
}},
&tls.SupportedPointsExtension{SupportedPoints: []byte{
0x00, // pointFormatUncompressed
}},
&tls.GenericExtension {Id: 0x000f}, // WARNING: UNKNOWN EXTENSION, USE AT YOUR OWN RISK
&tls.UtlsPaddingExtension{GetPaddingLen: tls.BoringPaddingStyle},
},
}
tlsConn.ApplyPreset(&clientHelloSpec)
n, err = tlsConn.Write([]byte("Hello, World!"))
// or tlsConn.Handshake() for better control