| 123456789101112131415161718192021222324252627282930313233343536373839404142 | 
							- package tf_test
 
- import (
 
- 	"context"
 
- 	"crypto/tls"
 
- 	"net"
 
- 	"testing"
 
- 	tf "github.com/sagernet/sing-box/common/tlsfragment"
 
- 	"github.com/stretchr/testify/require"
 
- )
 
- func TestTLSFragment(t *testing.T) {
 
- 	t.Parallel()
 
- 	tcpConn, err := net.Dial("tcp", "1.1.1.1:443")
 
- 	require.NoError(t, err)
 
- 	tlsConn := tls.Client(tf.NewConn(tcpConn, context.Background(), true, false, 0), &tls.Config{
 
- 		ServerName: "www.cloudflare.com",
 
- 	})
 
- 	require.NoError(t, tlsConn.Handshake())
 
- }
 
- func TestTLSRecordFragment(t *testing.T) {
 
- 	t.Parallel()
 
- 	tcpConn, err := net.Dial("tcp", "1.1.1.1:443")
 
- 	require.NoError(t, err)
 
- 	tlsConn := tls.Client(tf.NewConn(tcpConn, context.Background(), false, true, 0), &tls.Config{
 
- 		ServerName: "www.cloudflare.com",
 
- 	})
 
- 	require.NoError(t, tlsConn.Handshake())
 
- }
 
- func TestTLS2Fragment(t *testing.T) {
 
- 	t.Parallel()
 
- 	tcpConn, err := net.Dial("tcp", "1.1.1.1:443")
 
- 	require.NoError(t, err)
 
- 	tlsConn := tls.Client(tf.NewConn(tcpConn, context.Background(), true, true, 0), &tls.Config{
 
- 		ServerName: "www.cloudflare.com",
 
- 	})
 
- 	require.NoError(t, tlsConn.Handshake())
 
- }
 
 
  |