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