This commit is contained in:
crusader 2018-06-01 18:10:33 +09:00
parent e310736bec
commit 02f72e5481

View File

@ -8,17 +8,17 @@ import (
"net"
"git.loafle.net/commons/util-go/net/gateway"
noauthprobeM "git.loafle.net/overflow/commons-go/model/noauthprobe"
ocmn "git.loafle.net/overflow/commons-go/model/noauthprobe"
"github.com/shirou/gopsutil/host"
)
func GetRegistHeader(apiKey string) (string, error) {
var err error
nap := noauthprobeM.NoAuthProbe{
nap := ocmn.NoAuthProbe{
APIKey: apiKey,
}
var napd *noauthprobeM.NoAuthProbeDescription
var napd *ocmn.NoAuthProbeDescription
if napd, err = getDescription(); nil != err {
return "", err
}
@ -38,9 +38,9 @@ func GetRegistHeader(apiKey string) (string, error) {
return enc, nil
}
func getDescription() (*noauthprobeM.NoAuthProbeDescription, error) {
func getDescription() (*ocmn.NoAuthProbeDescription, error) {
var err error
napd := &noauthprobeM.NoAuthProbeDescription{}
napd := &ocmn.NoAuthProbeDescription{}
if napd.Host, err = getHost(); nil != err {
return nil, err
@ -53,9 +53,9 @@ func getDescription() (*noauthprobeM.NoAuthProbeDescription, error) {
return napd, nil
}
func getHost() (*noauthprobeM.NoAuthProbeDescriptionHost, error) {
func getHost() (*ocmn.NoAuthProbeDescriptionHost, error) {
if i, err := host.Info(); nil == err {
h := &noauthprobeM.NoAuthProbeDescriptionHost{}
h := &ocmn.NoAuthProbeDescriptionHost{}
h.Name = i.Hostname
h.OS = i.OS
@ -70,7 +70,7 @@ func getHost() (*noauthprobeM.NoAuthProbeDescriptionHost, error) {
}
}
func getNetwork() (*noauthprobeM.NoAuthProbeDescriptionNetwork, error) {
func getNetwork() (*ocmn.NoAuthProbeDescriptionNetwork, error) {
var ip net.IP
var iface string
var err error
@ -96,7 +96,7 @@ func getNetwork() (*noauthprobeM.NoAuthProbeDescriptionNetwork, error) {
return nil, errors.New("Interface of gateway is not exist")
}
n := &noauthprobeM.NoAuthProbeDescriptionNetwork{}
n := &ocmn.NoAuthProbeDescriptionNetwork{}
i := interfaces[idx]