github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/pkg/net/proxy/trojan/client_test.go (about)

     1  package trojan
     2  
     3  import (
     4  	"bytes"
     5  	"testing"
     6  
     7  	"github.com/Asutorufa/yuhaiin/pkg/net/netapi"
     8  	"github.com/Asutorufa/yuhaiin/pkg/net/proxy/socks5/tools"
     9  )
    10  
    11  func TestXxx(t *testing.T) {
    12  	b := bytes.NewBuffer(nil)
    13  
    14  	tools.EncodeAddr(netapi.ParseAddressPort(0, "www.baidu.com", netapi.EmptyPort), b)
    15  	size := b.Len()
    16  
    17  	b.Write([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11})
    18  	// for b.Len() > 0 {
    19  	// 	z := b.Next(399)
    20  
    21  	// 	t.Log(len(z), z)
    22  	// }
    23  
    24  	b.Truncate(size)
    25  	b.Write([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11})
    26  	t.Log(b.Bytes())
    27  }