-
Notifications
You must be signed in to change notification settings - Fork 0
/
other.go
46 lines (38 loc) · 848 Bytes
/
other.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package commons
import "github.com/tuya/tuya-tedge-driver-sdk-go/internal/proto"
type Response struct {
Success bool `json:"success"`
Message string `json:"message"`
Payload []byte `json:"payload"`
}
type AppDriverReq struct {
Header *Header
Payload []byte
}
type Header struct {
Tag string
From string
Option map[string]string
}
func (req *AppDriverReq) ToRpc() *proto.Data {
return &proto.Data{
Name: "",
Header: &proto.Header{
Tag: req.Header.Tag,
From: req.Header.From,
Option: req.Header.Option,
},
Payload: req.Payload,
}
}
//////////////////////////////////////////////////////////////////////////////////////
type ProxyInfo struct {
Host string `json:"host"`
Port int `json:"port"`
}
func DefaultProxyInfo(port int) ProxyInfo {
return ProxyInfo{
Host: "127.0.0.1",
Port: port,
}
}