Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Add dns-sd types to wot package
Browse files Browse the repository at this point in the history
  • Loading branch information
farshidtz committed Apr 29, 2021
1 parent d67bb61 commit cf90e2f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
3 changes: 0 additions & 3 deletions catalog/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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},
Expand Down
11 changes: 11 additions & 0 deletions wot/discovery.go
Original file line number Diff line number Diff line change
@@ -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
)

0 comments on commit cf90e2f

Please sign in to comment.