From ad26e789e9e608b50b4e2d7304fd8e4df35fb126 Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:25:11 -0700 Subject: Register server address on local network with Bonjour --- cmd/mobius-hotline-server/main.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cmd') 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)) } -- cgit