forked from JointCloud/pcm-coordinator
33 lines
909 B
Go
33 lines
909 B
Go
package remoteUtil
|
||
|
||
import (
|
||
"fmt"
|
||
"github.com/go-resty/resty/v2"
|
||
)
|
||
|
||
type EvidenceParam struct {
|
||
Url string `json:"url"`
|
||
Type string `json:"type"`
|
||
MemberName string `json:"memberName"`
|
||
ContractAddress string `json:"contractAddress"`
|
||
FunctionName string `json:"functionName"`
|
||
Args []string `json:"args"`
|
||
Token string `json:"token"`
|
||
UserIp string `json:"userIp"`
|
||
Amount int64 `json:"amount"`
|
||
}
|
||
|
||
func Evidence(EvidenceParam EvidenceParam) error {
|
||
fmt.Println("输出的user ip为:" + EvidenceParam.UserIp)
|
||
httpClient := resty.New().R()
|
||
_, err := httpClient.SetHeader("Content-Type", "application/json").
|
||
SetHeader("X-Forwarded-For", EvidenceParam.UserIp).
|
||
SetHeader("Authorization", EvidenceParam.Token).
|
||
SetBody(&EvidenceParam).
|
||
Post(EvidenceParam.Url)
|
||
if err != nil {
|
||
return err
|
||
}
|
||
return nil
|
||
}
|