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() {
|
|
}
|