aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2024-07-26 15:25:11 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2024-07-26 15:25:11 -0700
commitad26e789e9e608b50b4e2d7304fd8e4df35fb126 (patch)
tree91e687526d0d4797c05b951d65fb5ca21b7c9fc0 /cmd
parent6e4935b32843d1007b1070275d4e99edb345d6bc (diff)
Register server address on local network with Bonjour
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mobius-hotline-server/main.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd/mobius-hotline-server/main.go b/cmd/mobius-hotline-server/main.go
index 6b82764..e2c7789 100644
--- a/cmd/mobius-hotline-server/main.go
+++ b/cmd/mobius-hotline-server/main.go
@@ -7,6 +7,7 @@ import (
"fmt"
"github.com/jhalter/mobius/hotline"
"github.com/jhalter/mobius/internal/mobius"
+ "github.com/oleksandr/bonjour"
"io"
"log"
"os"
@@ -168,6 +169,12 @@ func main() {
// Assign functions to handle specific Hotline transaction types
mobius.RegisterHandlers(srv)
+ s, err := bonjour.Register(srv.Config.Name, "_hotline._tcp", "", *basePort, []string{"txtv=1", "app=hotline"}, nil)
+ if err != nil {
+ slogger.Error("Error registering Hotline server with Bonjour", "err", err)
+ }
+ defer s.Shutdown()
+
// Serve Hotline requests until program exit
log.Fatal(srv.ListenAndServe(ctx))
}