This commit is contained in:
crusader 2018-08-29 12:14:12 +09:00
parent b88509516a
commit 0f9f14aedc

View File

@ -17,52 +17,6 @@ import (
"github.com/grandcat/zeroconf"
)
type serviceMeta struct {
name string
cryptoType string
}
var (
serviceMetaMapping = map[string]*serviceMeta{
"http": &serviceMeta{
name: "HTTP",
cryptoType: "NONE",
},
"printer": &serviceMeta{
name: "PRINTER",
cryptoType: "NONE",
},
"pdl-datastream": &serviceMeta{
name: "PDL-DATASTREAM",
cryptoType: "NONE",
},
"ipp": &serviceMeta{
name: "IPP",
cryptoType: "NONE",
},
"webdav": &serviceMeta{
name: "WEBDAV",
cryptoType: "NONE",
},
"webdavs": &serviceMeta{
name: "WEBDAV",
cryptoType: "TLS",
},
"afpovertcp": &serviceMeta{
name: "AFP",
cryptoType: "NONE",
},
"smb": &serviceMeta{
name: "SMB",
cryptoType: "NONE",
},
"rfb": &serviceMeta{
name: "RFB",
cryptoType: "NONE",
},
}
)
func Scan(discovered model.Discovered) {
serviceEntries, err := browse("_services._dns-sd._udp", "local")
if nil != err {
@ -204,14 +158,9 @@ func parseService(service string) (name string, portType string, cryptoType stri
_name := strings.TrimLeft(ss[0], "_")
_portType := strings.TrimLeft(ss[1], "_")
m, ok := serviceMetaMapping[_name]
if !ok {
return "UNKNOWN", "UNKNOWN", "UNKNOWN"
}
name = m.name
name = _name
portType = _portType
cryptoType = m.cryptoType
cryptoType = "NONE"
return
}