ing
This commit is contained in:
parent
6be23297a4
commit
a9f2de065e
|
@ -18,6 +18,18 @@ const (
|
||||||
TargetSSDPAll = "ssdp:all"
|
TargetSSDPAll = "ssdp:all"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
deviceTypes = map[string]omm.MetaHostTypeEnum{
|
||||||
|
"urn:schemas-upnp-org:device:InternetGatewayDevice:1": omm.MetaHostTypeEnumRouter,
|
||||||
|
"urn:schemas-upnp-org:device:InternetGatewayDevice:2": omm.MetaHostTypeEnumRouter,
|
||||||
|
"urn:schemas-upnp-org:device:WLANAccessPointDevice:1": omm.MetaHostTypeEnumWLANAccessPoint,
|
||||||
|
"urn:schemas-upnp-org:device:MediaServer:1": omm.MetaHostTypeEnumMediaServer,
|
||||||
|
"urn:schemas-upnp-org:device:MediaServer:2": omm.MetaHostTypeEnumMediaServer,
|
||||||
|
"urn:schemas-upnp-org:device:MediaServer:3": omm.MetaHostTypeEnumMediaServer,
|
||||||
|
"urn:schemas-upnp-org:device:MediaServer:4": omm.MetaHostTypeEnumMediaServer,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func Scan(discoverySession session.DiscoverySession) error {
|
func Scan(discoverySession session.DiscoverySession) error {
|
||||||
devs, err := goupnp.DiscoverDevices(TargetRootDevice)
|
devs, err := goupnp.DiscoverDevices(TargetRootDevice)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
|
@ -74,6 +86,13 @@ LOOP:
|
||||||
h.Name = rd.ModelName
|
h.Name = rd.ModelName
|
||||||
h.DiscoveredDate = omu.NowPtr()
|
h.DiscoveredDate = omu.NowPtr()
|
||||||
|
|
||||||
|
mht, ok := deviceTypes[rd.DeviceType]
|
||||||
|
if ok {
|
||||||
|
h.HostType = mht.String()
|
||||||
|
} else {
|
||||||
|
h.HostType = omm.MetaHostTypeEnumHost.String()
|
||||||
|
}
|
||||||
|
|
||||||
discoverySession.AddHost(
|
discoverySession.AddHost(
|
||||||
omm.ToMetaDiscovererType(omm.MetaDiscovererTypeEnumUPnP),
|
omm.ToMetaDiscovererType(omm.MetaDiscovererTypeEnumUPnP),
|
||||||
h,
|
h,
|
||||||
|
|
|
@ -722,7 +722,8 @@ func (ds *ofDiscoverySession) addtionalHostMDNS(host *omd.Host, meta map[string]
|
||||||
_model, ok := meta["model"]
|
_model, ok := meta["model"]
|
||||||
if ok || "" != _model {
|
if ok || "" != _model {
|
||||||
h.HostModel = _model
|
h.HostModel = _model
|
||||||
if "Synology" == _vendor && strings.Contains(_model, "DS1817+") {
|
// if "Synology" == _vendor && strings.Contains(_model, "DS1817+") {
|
||||||
|
if "Synology" == _vendor && strings.Contains(_model, "DS") {
|
||||||
h.HostType = omm.MetaHostTypeEnumNAS.String()
|
h.HostType = omm.MetaHostTypeEnumNAS.String()
|
||||||
}
|
}
|
||||||
modified = true
|
modified = true
|
||||||
|
@ -744,9 +745,9 @@ func (ds *ofDiscoverySession) addtionalHostUPnP(host *omd.Host, meta map[string]
|
||||||
_model, ok := meta["ModelName"]
|
_model, ok := meta["ModelName"]
|
||||||
if ok || "" != _model {
|
if ok || "" != _model {
|
||||||
h.HostModel = _model
|
h.HostModel = _model
|
||||||
if "EFM Networks" == _vendor && strings.Contains(_model, "ipTIME A2004NS") {
|
// if "EFM Networks" == _vendor && strings.Contains(_model, "ipTIME A2004NS") {
|
||||||
h.HostType = omm.MetaHostTypeEnumRouter.String()
|
// h.HostType = omm.MetaHostTypeEnumRouter.String()
|
||||||
}
|
// }
|
||||||
modified = true
|
modified = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user