github.com/JimmyHuang454/JLS-go@v0.0.0-20230831150107-90d536585ba0/main.go (about) 1 package main 2 3 import "C" 4 5 import ( 6 "log" 7 8 "github.com/JimmyHuang454/JLS-go/tls" 9 ) 10 11 var certPem = []byte(`-----BEGIN CERTIFICATE----- 12 MIIBhTCCASugAwIBAgIQIRi6zePL6mKjOipn+dNuaTAKBggqhkjOPQQDAjASMRAw 13 DgYDVQQKEwdBY21lIENvMB4XDTE3MTAyMDE5NDMwNloXDTE4MTAyMDE5NDMwNlow 14 EjEQMA4GA1UEChMHQWNtZSBDbzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABD0d 15 7VNhbWvZLWPuj/RtHFjvtJBEwOkhbN/BnnE8rnZR8+sbwnc/KhCk3FhnpHZnQz7B 16 5aETbbIgmuvewdjvSBSjYzBhMA4GA1UdDwEB/wQEAwICpDATBgNVHSUEDDAKBggr 17 BgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MCkGA1UdEQQiMCCCDmxvY2FsaG9zdDo1 18 NDUzgg4xMjcuMC4wLjE6NTQ1MzAKBggqhkjOPQQDAgNIADBFAiEA2zpJEPQyz6/l 19 Wf86aX6PepsntZv2GYlA5UpabfT2EZICICpJ5h/iI+i341gBmLiAFQOyTDT+/wQc 20 6MF9+Yw1Yy0t 21 -----END CERTIFICATE-----`) 22 23 var keyPem = []byte(`-----BEGIN EC PRIVATE KEY----- 24 MHcCAQEEIIrYSSNQFaA2Hwf1duRSxKtLYX5CB04fSeQ6tF1aY/PuoAoGCCqGSM49 25 AwEHoUQDQgAEPR3tU2Fta9ktY+6P9G0cWO+0kETA6SFs38GecTyudlHz6xvCdz8q 26 EKTcWGekdmdDPsHloRNtsiCa697B2O9IFA== 27 -----END EC PRIVATE KEY-----`) 28 29 //export GetKey 30 func GetKey() bool { 31 log.SetFlags(log.Lshortfile) 32 33 conf := &tls.Config{ 34 InsecureSkipVerify: false, 35 } 36 37 conn, err := tls.Dial("tcp", "uif03.top:443", conf) 38 if err != nil { 39 log.Println(err) 40 return false 41 } 42 defer conn.Close() 43 44 n, err := conn.Write([]byte("GET http://uif03.top HTTP/1.1\r\nHost: uif03.top\r\n\r\n")) 45 if err != nil { 46 log.Println(n, err) 47 return false 48 } 49 50 buf := make([]byte, 2000) 51 for true { 52 n, err = conn.Read(buf) 53 if err != nil { 54 log.Println(n, err) 55 return false 56 } 57 58 println(string(buf[:n])) 59 conn.Close() 60 } 61 return true 62 } 63 64 func main() {}