zhangzengfei
2024-04-24 cc8263fb876b44a25960bc553ed13b9fbbef18e6
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
47
48
49
package client
 
import (
    "fmt"
    "io/ioutil"
 
    "gat1400Exchange/config"
    "gat1400Exchange/pkg/logger"
 
    dac "github.com/xinsnake/go-http-digest-auth-client"
)
 
const (
    RegisterUrI   = "/VIID/System/Register"
    UnRegisterUrI = "/VIID/System/UnRegister"
    KeepaliveUrI  = "/VIID/System/Keepalive"
    TimeUrI       = "/VIID/System/Time"
)
 
func register() {
    url := fmt.Sprintf("http://%s:%s%s", config.ClientConf.ServerAddr, config.ClientConf.ServerPort, RegisterUrI)
    dr := dac.NewRequest(config.ClientConf.Username, config.ClientConf.Password, "GET", url, "")
    resp, err := dr.Execute()
    if err != nil {
        logger.Error(err.Error())
        return
    }
    defer resp.Body.Close()
 
    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        logger.Error(err.Error())
        return
    }
 
    fmt.Printf(string(body))
}
 
func keepalive() {
 
}
 
func unRegister() {
 
}
 
func syncTime() {
 
}