Skip to content

Commit

Permalink
调整:指定不验证https
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Jun 20, 2024
1 parent 03a77e6 commit b6d1555
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion configure/fopsConfigure.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package configure

import (
"bytes"
"crypto/tls"
"encoding/json"
"fmt"
"github.com/farseer-go/fs/core"
Expand All @@ -22,7 +23,13 @@ func getFopsConfigure() ([]fopsConfigureVO, error) {
newRequest, _ := http.NewRequest("POST", url, bytes.NewReader(bodyByte))
newRequest.Header.Set("Content-Type", "application/json")
// 读取配置
client := &http.Client{}
client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true, // 不验证 HTTPS 证书
},
},
}
var lst []fopsConfigureVO
rsp, err := client.Do(newRequest)
if err != nil {
Expand Down
9 changes: 8 additions & 1 deletion flog/fopsProvider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package flog

import (
"bytes"
"crypto/tls"
"encoding/json"
"fmt"
"github.com/farseer-go/fs/configure"
Expand Down Expand Up @@ -88,7 +89,13 @@ func (r *fopsLoggerPersistent) upload(lstLog []*LogData) error {
newRequest, _ := http.NewRequest("POST", url, bytes.NewReader(bodyByte))
newRequest.Header.Set("Content-Type", "application/json")
// 链路追踪
client := &http.Client{}
client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true, // 不验证 HTTPS 证书
},
},
}
rsp, err := client.Do(newRequest)
if err != nil {
return fmt.Errorf("上传日志到FOPS失败:%s", err.Error())
Expand Down

0 comments on commit b6d1555

Please sign in to comment.