|
|
|
@ -19,9 +19,9 @@ import (
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
sn string
|
|
|
|
|
ip string
|
|
|
|
|
ident string
|
|
|
|
|
SN string
|
|
|
|
|
IP string
|
|
|
|
|
Ident string
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func LoopReport() {
|
|
|
|
@ -36,21 +36,21 @@ func LoopReport() {
|
|
|
|
|
|
|
|
|
|
func GatherBase() error {
|
|
|
|
|
var err error
|
|
|
|
|
sn, err = exec(config.Config.Report.SN)
|
|
|
|
|
SN, err = exec(config.Config.Report.SN)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("cannot get sn: %s", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ip, err = identity.GetIP()
|
|
|
|
|
IP, err = identity.GetIP()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("cannot get ip: %s", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !str.IsIP(ip) {
|
|
|
|
|
return fmt.Errorf("'%s' not ip", ip)
|
|
|
|
|
if !str.IsIP(IP) {
|
|
|
|
|
return fmt.Errorf("'%s' not ip", IP)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ident, err = identity.GetIdent()
|
|
|
|
|
Ident, err = identity.GetIdent()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("cannot get ident: %s", err)
|
|
|
|
|
}
|
|
|
|
@ -98,9 +98,9 @@ func report() error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
form := hostRegisterForm{
|
|
|
|
|
SN: sn,
|
|
|
|
|
IP: ip,
|
|
|
|
|
Ident: ident,
|
|
|
|
|
SN: SN,
|
|
|
|
|
IP: IP,
|
|
|
|
|
Ident: Ident,
|
|
|
|
|
Name: name,
|
|
|
|
|
Cate: config.Config.Report.Cate,
|
|
|
|
|
UniqKey: config.Config.Report.UniqKey,
|
|
|
|
|