1234567891011121314151617181920212223242526272829303132 |
- 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(), 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(), true, 0), &tls.Config{
- ServerName: "www.cloudflare.com",
- })
- require.NoError(t, tlsConn.Handshake())
- }
|