|
@@ -1,9 +1,10 @@
|
|
|
-package analysiscode
|
|
|
+package main
|
|
|
|
|
|
import (
|
|
|
"analysiscode/proto"
|
|
|
"bytes"
|
|
|
"context"
|
|
|
+ "crypto/tls"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"net"
|
|
@@ -26,7 +27,7 @@ type CodeService struct {
|
|
|
}
|
|
|
|
|
|
//server
|
|
|
-func main1() {
|
|
|
+func main() {
|
|
|
util.Debug("port", spiderutil.Config.ServerPort)
|
|
|
lis, err := net.Listen("tcp", spiderutil.Config.ServerPort)
|
|
|
if err != nil {
|
|
@@ -67,7 +68,9 @@ func getCode(path, stype, head, cookie string) (code string, respheader http.Hea
|
|
|
|
|
|
func getCodeByFree(path, stype, head, cookie string) (code string, respheader http.Header, respcookie []*http.Cookie, getCodeResp *req.Response) {
|
|
|
defer util.Catch()
|
|
|
- client := req.C().SetTimeout(spiderutil.Config.TimeOut * time.Second)
|
|
|
+ client := req.C().
|
|
|
+ SetTimeout(spiderutil.Config.TimeOut * time.Second).
|
|
|
+ SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true}) //忽略证书验证
|
|
|
headers := map[string]string{}
|
|
|
if head != "" {
|
|
|
json.Unmarshal([]byte(head), &headers)
|
|
@@ -124,7 +127,9 @@ func getCodeByFree(path, stype, head, cookie string) (code string, respheader ht
|
|
|
|
|
|
func getCodeByPay(path, stype, head, cookie string) (code string, respheader http.Header, respcookie []*http.Cookie) {
|
|
|
defer util.Catch()
|
|
|
- client := req.C().SetTimeout(spiderutil.Config.TimeOut * time.Second)
|
|
|
+ client := req.C().
|
|
|
+ SetTimeout(spiderutil.Config.TimeOut * time.Second).
|
|
|
+ SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true}) //忽略证书验证
|
|
|
headers := map[string]string{}
|
|
|
if head != "" {
|
|
|
json.Unmarshal([]byte(head), &headers)
|