//go:build windows package yu_curl import ( "fmt" "runtime" "runtime/debug" "testing" "time" ) func Test(t *testing.T) { fmt.Println(Version()) } func TestCurl(t *testing.T) { j_curl := NewRequest() defer j_curl.Close() j_curl.SetHeader("aaaaaaaaa", "dddddddddd") j_curl.Get("https://fanyi.baidu.com/mtpe/project/getDefaultId?_=1694941090604") fmt.Println(j_curl.RespStatusCode()) fmt.Println(j_curl.RespLen()) fmt.Println(len(j_curl.RespBody())) j_s := j_curl.RespBodyS() fmt.Println("j_s1", j_s) j_curl.SetHeader("aaaaaaaaa", "") j_curl.Get("https://fanyi.baidu.com/mtpe/v2/user/getInfo?_=1694941089645") fmt.Println(j_curl.RespStatusCode()) fmt.Println(j_curl.RespLen()) fmt.Println(len(j_curl.RespBody())) fmt.Println(len(j_curl.RespBodyS())) fmt.Println("j_s2", j_s) j_s = j_curl.RespBodyS() fmt.Println("j_s3", j_s) } func TestThread(t *testing.T) { debug.SetMaxThreads(30000) time.Sleep(time.Second * 5) for i := 0; i < 10000; i++ { go func() { // j_curl := NewRequest() // defer j_curl.Close() fmt.Println("get-") time.Sleep(time.Second * 5) }() } time.Sleep(time.Second * 15) runtime.GC() time.Sleep(time.Second * 1) runtime.GC() time.Sleep(time.Second * 1) runtime.GC() time.Sleep(time.Second * 1) runtime.GC() time.Sleep(time.Second * 5) } // func TestWebSocket(t *testing.T) { // j_curl := NewRequest() // defer j_curl.Close() // // j_curl.SetProxy("http://11597193:49e79ewq16we@47.242.149.180:10657") // // fmt.Println(1 << 0) // // _ws: // j_curl.OpenWs("wss://ws.okx.com:8443/ws/v5/public") // // if j_err := j_curl.RespErr(); j_err == nil { // // j_bufs := []byte(`{"op":"subscribe","args":[{"channel":"mark-price","instId":"BTC-USDT"}]}`) // j_sent := 0 // fmt.Println(curl_ws_send.Call(j_curl.curl, j_bufs, len(j_bufs), &j_sent, 0, 1)) // // for { // time.Sleep(time.Microsecond * 100) // j_bufss := make([]byte, 24) // j_ddddd := uintptr(0) // j_bufs = make([]byte, 1024) // fmt.Println(curl_ws_recv.Call(j_curl.curl, j_bufs, len(j_bufs), &j_sent, &j_ddddd)) // fmt.Println("j_bufs", j_bufss, string(j_bufs)) // if j_ddddd != 0 { // fmt.Println(*(*curl_ws_frame)(unsafe.Pointer(j_ddddd))) // } // } // time.Sleep(time.Second * 100) // } else { // fmt.Println(j_err) // goto _ws // } // // }