diff --git a/catalog/catalog.go b/catalog/catalog.go index 61c5a5b..0d0c808 100644 --- a/catalog/catalog.go +++ b/catalog/catalog.go @@ -14,9 +14,6 @@ type ThingDescription = map[string]interface{} const ( ResponseContextURL = "https://linksmart.eu/thing-directory/context.jsonld" ResponseType = "Catalog" - // DNS-SD - DNSSDServiceType = "_wot._tcp" - DNSSDServiceSubtype = "_directory" // _directory._sub._wot._tcp // Storage backend types BackendMemory = "memory" BackendLevelDB = "leveldb" diff --git a/discovery.go b/discovery.go index 29ade98..af3584d 100644 --- a/discovery.go +++ b/discovery.go @@ -12,7 +12,7 @@ import ( "github.com/linksmart/go-sec/auth/obtainer" sc "github.com/linksmart/service-catalog/v3/catalog" "github.com/linksmart/service-catalog/v3/client" - "github.com/linksmart/thing-directory/catalog" + "github.com/linksmart/thing-directory/wot" ) // escape special characters as recommended by https://tools.ietf.org/html/rfc6763#section-4.3 @@ -29,7 +29,7 @@ func registerDNSSDService(conf *Config) (func(), error) { instance := escapeDNSSDServiceInstance(conf.DNSSD.Publish.Instance) log.Printf("DNS-SD: registering as \"%s.%s.%s\", subtype: %s", - instance, catalog.DNSSDServiceType, conf.DNSSD.Publish.Domain, catalog.DNSSDServiceSubtype) + instance, wot.DNSSDServiceType, conf.DNSSD.Publish.Domain, wot.DNSSDServiceSubtypeDirectory) var ifs []net.Interface @@ -52,7 +52,7 @@ func registerDNSSDService(conf *Config) (func(), error) { sd, err := zeroconf.Register( instance, - catalog.DNSSDServiceType+","+catalog.DNSSDServiceSubtype, + wot.DNSSDServiceType+","+wot.DNSSDServiceSubtypeDirectory, conf.DNSSD.Publish.Domain, conf.HTTP.BindPort, []string{"td=/td", "version=" + Version}, diff --git a/wot/discovery.go b/wot/discovery.go new file mode 100644 index 0000000..b2fb2f8 --- /dev/null +++ b/wot/discovery.go @@ -0,0 +1,11 @@ +package wot + +const ( + // Media Types + MediaTypeJSONLD = "application/ld+json" + MediaTypeJSON = "application/ld+json" + // DNS-SD Types + DNSSDServiceType = "_wot._tcp" + DNSSDServiceSubtypeThing = "_thing" // _thing._sub._wot._tcp + DNSSDServiceSubtypeDirectory = "_directory" // _directory._sub._wot._tcp +)