修改初始化方法
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// 初始化
|
// 初始化
|
||||||
rpc.InitiateRequest("127.0.0.1", 9631, "/root/cert.pem")
|
rpc.Initiate("127.0.0.1", 9631, "/root/cert.pem")
|
||||||
// 获取设备详情
|
// 获取设备详情
|
||||||
result, err := rpc.GetDevice().GetDetail(10001)
|
result, err := rpc.GetDevice().GetDetail(10001)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ func (r *Request) Send(methodName string, body any, responseBody any) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化请求类
|
// 初始化
|
||||||
func InitiateRequest(host string, port uint16, rootCertPath string) error {
|
func Initiate(host string, port uint16, rootCertPath string) error {
|
||||||
rootCert, err := os.ReadFile(rootCertPath)
|
rootCert, err := os.ReadFile(rootCertPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cert file read fail")
|
return fmt.Errorf("cert file read fail")
|
||||||
|
|||||||
Reference in New Issue
Block a user