File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "github.com/OpenIoTHub/gateway-go/v2/client"
5+ "github.com/OpenIoTHub/gateway-go/v2/register"
6+ "net"
7+ "time"
8+ )
9+
10+ func main () {
11+ client .Run ()
12+ register .RegisterService ("localhost-gateway-go" ,
13+ "_http._tcp" ,
14+ "local" ,
15+ "localhost" ,
16+ 34323 ,
17+ []string {"name=gateway-go" , "home-page=https://github.com/OpenIoTHub/gateway-go" },
18+ 0 ,
19+ []net.IP {net .ParseIP ("127.0.0.1" )},
20+ []net.IP {},
21+ )
22+ time .Sleep (500 * time .Second )
23+ }
Original file line number Diff line number Diff line change 44 "fmt"
55 client "github.com/OpenIoTHub/gateway-go/v2/client"
66 "github.com/OpenIoTHub/gateway-go/v2/config"
7+ "github.com/OpenIoTHub/gateway-go/v2/register"
78 "github.com/OpenIoTHub/gateway-go/v2/services"
89 "github.com/OpenIoTHub/gateway-go/v2/utils/login_utils"
910 "github.com/OpenIoTHub/gateway-go/v2/utils/qr"
@@ -14,6 +15,7 @@ import (
1415 "gopkg.in/yaml.v3"
1516 "io"
1617 "log"
18+ "net"
1719 "os"
1820 "sync"
1921)
@@ -100,6 +102,16 @@ func main() {
100102 wg .Wait ()
101103 return nil
102104 }
105+ register .RegisterService ("localhost-gateway-go" ,
106+ "_http._tcp" ,
107+ "local" ,
108+ "localhost" ,
109+ 34323 ,
110+ []string {"name=gateway-go" , "home-page=https://github.com/OpenIoTHub/gateway-go" },
111+ 0 ,
112+ []net.IP {net .ParseIP ("127.0.0.1" )},
113+ []net.IP {},
114+ )
103115 err := myApp .Run (os .Args )
104116 if err != nil {
105117 log .Println (err .Error ())
You can’t perform that action at this time.
0 commit comments