Skip to content

Commit f2a2a6a

Browse files
Support Gateway with Multiple Devices using the Same Endpoint (#128)
* Support Gateway with Multiple Devices using the Same Endpoint Allows multiple devices to be connected to the same endpoint. By utilizing a single endpoint, multiple devices can now be exposed and controlled efficiently. To achieve this, a new query parameter, "di"(DeviceID) has been added to each command. This parameter is used to specify the target device for the command execution. --------- Co-authored-by: Patrik Matiaško <patrik.matiasko@gmail.com>
1 parent a634614 commit f2a2a6a

22 files changed

Lines changed: 651 additions & 376 deletions

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ linters:
2323
# - contextcheck # check the function whether use a non-inherited context
2424
- deadcode # Finds unused code
2525
- decorder # check declaration order and count of types, constants, variables and functions
26-
- depguard # Go linter that checks if package imports are in a list of acceptable packages
26+
# - depguard # Go linter that checks if package imports are in a list of acceptable packages
2727
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
2828
- dupl # Tool for code clone detection
2929
- durationcheck # check for two durations multiplied together

.goreleaser.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@ builds:
3535
- bash -c "test {{.Os}} == "windows" || test {{.Os}} == "darwin" || upx --best --lzma {{.Path}}"
3636
- make inject-web CLIENT_APPLICATION_BINARY_PATH={{.Path}} UI_SEPARATOR={{.Env.UI_SEPARATOR}} UI_FILE={{.Env.UI_FILE}}
3737
archives:
38-
- replacements:
39-
darwin: macOS
40-
linux: linux
41-
windows: windows
42-
386: i386
43-
amd64: amd64
38+
- name_template: '{{ .ProjectName }}_{{ .Version }}_{{ if eq .Os "darwin" }}macOS{{ else }}{{.Os}}{{ end }}_{{ if eq .Arch "386"}}i{{ end }}{{ .Arch }}'
4439
wrap_in_directory: true
4540
format_overrides:
4641
- goos: windows

cmd/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ func main() {
6363
log.Errorf("cannot extract UI: %v", err)
6464
}
6565
}
66-
fileWatcher, err := fsnotify.NewWatcher()
66+
logger := log.NewLogger(cfg.Log)
67+
log.Set(logger)
68+
fileWatcher, err := fsnotify.NewWatcher(logger)
6769
if err != nil {
6870
log.Errorf("cannot create file fileWatcher: %v", err)
6971
return
7072
}
7173
defer func() {
7274
_ = fileWatcher.Close()
7375
}()
74-
logger := log.NewLogger(cfg.Log)
75-
log.Set(logger)
7676
log.Debugf("version: %v, buildDate: %v, buildRevision %v", Version, BuildDate, CommitHash)
7777
log.Debugf("config:\n%v", cfg.String())
7878
info := grpc.ServiceInformation{

go.mod

Lines changed: 104 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,40 @@ module github.com/plgd-dev/client-application
33
go 1.18
44

55
require (
6-
cloud.google.com/go v0.107.0
6+
cloud.google.com/go v0.110.3
77
github.com/favadi/protoc-go-inject-tag v1.4.0
88
github.com/fullstorydev/grpchan v1.1.1
9-
github.com/golang-jwt/jwt/v4 v4.4.3
9+
github.com/golang-jwt/jwt/v4 v4.5.0
1010
github.com/google/uuid v1.3.0
1111
github.com/goreleaser/goreleaser v1.9.2
1212
github.com/gorilla/handlers v1.5.1
1313
github.com/gorilla/mux v1.8.0
14-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0
15-
github.com/jellydator/ttlcache/v3 v3.0.0
14+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0
15+
github.com/jellydator/ttlcache/v3 v3.0.1
1616
github.com/jessevdk/go-flags v1.5.0
17-
github.com/lestrrat-go/jwx v1.2.25
18-
github.com/pion/dtls/v2 v2.1.6-0.20230201184248-11ea8c257a48
19-
github.com/plgd-dev/device/v2 v2.0.6-0.20230207123337-38ef68052803
20-
github.com/plgd-dev/go-coap/v3 v3.1.2-0.20230202152709-d4fc0ce1262e
21-
github.com/plgd-dev/hub/v2 v2.7.12-0.20230211114617-ae5c9bac7b22
17+
github.com/lestrrat-go/jwx v1.2.26
18+
github.com/pion/dtls/v2 v2.2.7
19+
github.com/plgd-dev/device/v2 v2.2.1-0.20230602173355-efc3a81993c3
20+
github.com/plgd-dev/go-coap/v3 v3.1.3
21+
github.com/plgd-dev/hub/v2 v2.7.19
2222
github.com/plgd-dev/kit/v2 v2.0.0-20211006190727-057b33161b90
23-
github.com/stretchr/testify v1.8.1
24-
go.opentelemetry.io/otel/trace v1.12.0
25-
go.uber.org/atomic v1.10.0
23+
github.com/stretchr/testify v1.8.4
24+
go.opentelemetry.io/otel/trace v1.14.0
25+
go.uber.org/atomic v1.11.0
2626
go.uber.org/zap v1.24.0
27-
google.golang.org/api v0.109.0
28-
google.golang.org/grpc v1.52.3
29-
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0
30-
google.golang.org/protobuf v1.28.1
27+
google.golang.org/api v0.129.0
28+
google.golang.org/grpc v1.56.1
29+
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
30+
google.golang.org/protobuf v1.31.0
3131
gopkg.in/yaml.v3 v3.0.1
3232
)
3333

3434
require (
35-
cloud.google.com/go/compute v1.18.0 // indirect
35+
cloud.google.com/go/compute v1.20.1 // indirect
3636
cloud.google.com/go/compute/metadata v0.2.3 // indirect
37-
cloud.google.com/go/iam v0.8.0 // indirect
38-
cloud.google.com/go/kms v1.6.0 // indirect
39-
cloud.google.com/go/storage v1.27.0 // indirect
37+
cloud.google.com/go/iam v0.13.0 // indirect
38+
cloud.google.com/go/kms v1.10.1 // indirect
39+
cloud.google.com/go/storage v1.30.1 // indirect
4040
code.gitea.io/sdk/gitea v0.15.1 // indirect
4141
github.com/AlekSi/pointer v1.2.0 // indirect
4242
github.com/Azure/azure-pipeline-go v0.2.3 // indirect
@@ -77,15 +77,16 @@ require (
7777
github.com/aws/aws-sdk-go-v2/service/sts v1.7.0 // indirect
7878
github.com/aws/smithy-go v1.8.0 // indirect
7979
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb // indirect
80+
github.com/bufbuild/protocompile v0.5.1 // indirect
8081
github.com/caarlos0/ctrlc v1.0.0 // indirect
8182
github.com/caarlos0/env/v6 v6.9.2 // indirect
8283
github.com/caarlos0/go-reddit/v3 v3.0.1 // indirect
8384
github.com/caarlos0/go-shellwords v1.0.12 // indirect
8485
github.com/cavaliergopher/cpio v1.0.1 // indirect
85-
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
86+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
8687
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
8788
github.com/davecgh/go-spew v1.1.1 // indirect
88-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
89+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
8990
github.com/dghubble/go-twitter v0.0.0-20211115160449-93a8679adecb // indirect
9091
github.com/dghubble/oauth1 v0.7.1 // indirect
9192
github.com/dghubble/sling v1.4.0 // indirect
@@ -96,30 +97,33 @@ require (
9697
github.com/felixge/httpsnoop v1.0.3 // indirect
9798
github.com/fsnotify/fsnotify v1.6.0 // indirect
9899
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
100+
github.com/go-co-op/gocron v1.22.4 // indirect
99101
github.com/go-git/gcfg v1.5.0 // indirect
100102
github.com/go-git/go-billy/v5 v5.3.1 // indirect
101103
github.com/go-git/go-git/v5 v5.4.2 // indirect
102-
github.com/go-logr/logr v1.2.3 // indirect
104+
github.com/go-logr/logr v1.2.4 // indirect
103105
github.com/go-logr/stdr v1.2.2 // indirect
104106
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible // indirect
105107
github.com/gobwas/glob v0.2.3 // indirect
106-
github.com/goccy/go-json v0.10.0 // indirect
107-
github.com/golang/glog v1.0.0 // indirect
108+
github.com/goccy/go-json v0.10.2 // indirect
109+
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
110+
github.com/golang/glog v1.1.0 // indirect
108111
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
109-
github.com/golang/protobuf v1.5.2 // indirect
112+
github.com/golang/protobuf v1.5.3 // indirect
110113
github.com/golang/snappy v0.0.4 // indirect
111114
github.com/google/go-cmp v0.5.9 // indirect
112115
github.com/google/go-github/v44 v44.1.0 // indirect
113116
github.com/google/go-querystring v1.1.0 // indirect
114117
github.com/google/rpmpack v0.0.0-20220314092521-38642b5e571e // indirect
118+
github.com/google/s2a-go v0.1.4 // indirect
115119
github.com/google/wire v0.5.0 // indirect
116-
github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect
117-
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
120+
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
121+
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
118122
github.com/goreleaser/chglog v0.1.2 // indirect
119123
github.com/goreleaser/fileglob v1.3.0 // indirect
120124
github.com/goreleaser/nfpm/v2 v2.15.1 // indirect
121125
github.com/gorilla/websocket v1.5.0 // indirect
122-
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
126+
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
123127
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.2 // indirect
124128
github.com/hashicorp/errwrap v1.1.0 // indirect
125129
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
@@ -131,19 +135,21 @@ require (
131135
github.com/imdario/mergo v0.3.12 // indirect
132136
github.com/inconshreveable/mousetrap v1.0.0 // indirect
133137
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
134-
github.com/jhump/protoreflect v1.14.1 // indirect
138+
github.com/jhump/protoreflect v1.15.1 // indirect
135139
github.com/jmespath/go-jmespath v0.4.0 // indirect
136140
github.com/json-iterator/go v1.1.12 // indirect
137141
github.com/jtacoma/uritemplates v1.0.0 // indirect
138142
github.com/karrick/tparse/v2 v2.8.2 // indirect
139143
github.com/kelseyhightower/envconfig v1.4.0 // indirect
140144
github.com/kevinburke/ssh_config v1.1.0 // indirect
141-
github.com/klauspost/compress v1.15.15 // indirect
145+
github.com/klauspost/compress v1.16.6 // indirect
142146
github.com/klauspost/pgzip v1.2.5 // indirect
143147
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
144148
github.com/lestrrat-go/blackmagic v1.0.1 // indirect
145149
github.com/lestrrat-go/httpcc v1.0.1 // indirect
150+
github.com/lestrrat-go/httprc v1.0.4 // indirect
146151
github.com/lestrrat-go/iter v1.0.2 // indirect
152+
github.com/lestrrat-go/jwx/v2 v2.0.11 // indirect
147153
github.com/lestrrat-go/option v1.0.1 // indirect
148154
github.com/mattn/go-colorable v0.1.9 // indirect
149155
github.com/mattn/go-ieproxy v0.0.1 // indirect
@@ -154,30 +160,30 @@ require (
154160
github.com/mitchellh/reflectwalk v1.0.2 // indirect
155161
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
156162
github.com/modern-go/reflect2 v1.0.2 // indirect
157-
github.com/montanaflynn/stats v0.7.0 // indirect
163+
github.com/montanaflynn/stats v0.7.1 // indirect
158164
github.com/muesli/mango v0.1.0 // indirect
159165
github.com/muesli/mango-cobra v1.1.0 // indirect
160166
github.com/muesli/mango-pflag v0.1.0 // indirect
161167
github.com/muesli/roff v0.1.0 // indirect
162168
github.com/nats-io/jwt/v2 v2.2.0 // indirect
163-
github.com/nats-io/nats.go v1.23.0 // indirect
164-
github.com/nats-io/nkeys v0.3.0 // indirect
169+
github.com/nats-io/nats.go v1.27.1 // indirect
170+
github.com/nats-io/nkeys v0.4.4 // indirect
165171
github.com/nats-io/nuid v1.0.1 // indirect
166-
github.com/panjf2000/ants/v2 v2.7.1 // indirect
172+
github.com/panjf2000/ants/v2 v2.7.4 // indirect
167173
github.com/pion/logging v0.2.2 // indirect
168-
github.com/pion/transport v0.14.1 // indirect
169-
github.com/pion/transport/v2 v2.0.0 // indirect
170-
github.com/pion/udp v0.1.2 // indirect
174+
github.com/pion/transport/v2 v2.2.1 // indirect
171175
github.com/pkg/errors v0.9.1 // indirect
172176
github.com/pmezard/go-difflib v1.0.0 // indirect
177+
github.com/robfig/cron/v3 v3.0.1 // indirect
173178
github.com/russross/blackfriday/v2 v2.1.0 // indirect
179+
github.com/segmentio/asm v1.2.0 // indirect
174180
github.com/sergi/go-diff v1.2.0 // indirect
175-
github.com/sirupsen/logrus v1.9.0 // indirect
181+
github.com/sirupsen/logrus v1.9.2 // indirect
176182
github.com/slack-go/slack v0.10.3 // indirect
177183
github.com/spf13/cobra v1.4.0 // indirect
178184
github.com/spf13/pflag v1.0.5 // indirect
179185
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
180-
github.com/ugorji/go/codec v1.2.8 // indirect
186+
github.com/ugorji/go/codec v1.2.11 // indirect
181187
github.com/ulikunitz/xz v0.5.10 // indirect
182188
github.com/x448/float16 v0.8.4 // indirect
183189
github.com/xanzy/go-gitlab v0.65.0 // indirect
@@ -186,33 +192,72 @@ require (
186192
github.com/xdg-go/scram v1.1.2 // indirect
187193
github.com/xdg-go/stringprep v1.0.4 // indirect
188194
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
189-
go.mongodb.org/mongo-driver v1.11.1 // indirect
195+
go.mongodb.org/mongo-driver v1.12.0 // indirect
190196
go.opencensus.io v0.24.0 // indirect
191-
go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.38.0 // indirect
192-
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.38.0 // indirect
193-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.38.0 // indirect
194-
go.opentelemetry.io/otel v1.12.0 // indirect
195-
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 // indirect
196-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.12.0 // indirect
197-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.12.0 // indirect
198-
go.opentelemetry.io/otel/metric v0.35.0 // indirect
199-
go.opentelemetry.io/otel/sdk v1.12.0 // indirect
200-
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
197+
go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.40.0 // indirect
198+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.40.0 // indirect
199+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0 // indirect
200+
go.opentelemetry.io/otel v1.14.0 // indirect
201+
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect
202+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect
203+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 // indirect
204+
go.opentelemetry.io/otel/metric v0.37.0 // indirect
205+
go.opentelemetry.io/otel/sdk v1.14.0 // indirect
206+
go.opentelemetry.io/proto/otlp v0.20.0 // indirect
201207
go.uber.org/multierr v1.9.0 // indirect
202208
gocloud.dev v0.24.0 // indirect
203-
golang.org/x/crypto v0.5.0 // indirect
204-
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 // indirect
205-
golang.org/x/net v0.5.0 // indirect
206-
golang.org/x/oauth2 v0.4.0 // indirect
207-
golang.org/x/sync v0.1.0 // indirect
208-
golang.org/x/sys v0.4.0 // indirect
209-
golang.org/x/text v0.6.0 // indirect
209+
golang.org/x/crypto v0.10.0 // indirect
210+
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
211+
golang.org/x/net v0.11.0 // indirect
212+
golang.org/x/oauth2 v0.9.0 // indirect
213+
golang.org/x/sync v0.3.0 // indirect
214+
golang.org/x/sys v0.9.0 // indirect
215+
golang.org/x/text v0.10.0 // indirect
210216
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
211217
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
212218
google.golang.org/appengine v1.6.7 // indirect
213-
google.golang.org/genproto v0.0.0-20230131230820-1c016267d619 // indirect
219+
google.golang.org/genproto v0.0.0-20230629202037-9506855d4529 // indirect
220+
google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 // indirect
221+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 // indirect
214222
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
215223
gopkg.in/mail.v2 v2.3.1 // indirect
216224
gopkg.in/warnings.v0 v0.1.2 // indirect
217225
gopkg.in/yaml.v2 v2.4.0 // indirect
218226
)
227+
228+
exclude (
229+
// note: opentelemetry must be kept at v1.14.0 as long as golang1.18 is supported
230+
go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.41.0
231+
go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.41.1
232+
go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo v0.42.0
233+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.41.0
234+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.41.1
235+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0
236+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.41.0
237+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.41.1
238+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0
239+
go.opentelemetry.io/otel v1.15.0
240+
go.opentelemetry.io/otel v1.15.1
241+
go.opentelemetry.io/otel v1.16.0
242+
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0
243+
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1
244+
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0
245+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0
246+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1
247+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0
248+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.0
249+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1
250+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0
251+
go.opentelemetry.io/otel/metric v0.38.0
252+
go.opentelemetry.io/otel/metric v0.38.1
253+
go.opentelemetry.io/otel/metric v1.16.0
254+
go.opentelemetry.io/otel/sdk v1.15.0
255+
go.opentelemetry.io/otel/sdk v1.15.1
256+
go.opentelemetry.io/otel/sdk v1.16.0
257+
go.opentelemetry.io/otel/trace v1.15.0
258+
go.opentelemetry.io/otel/trace v1.15.1
259+
go.opentelemetry.io/otel/trace v1.16.0
260+
// note: go.uber.org/multierr must be kept at v1.9.0 as long as golang1.18 is supported
261+
go.uber.org/multierr v1.10.0
262+
go.uber.org/multierr v1.11.0
263+
)

0 commit comments

Comments
 (0)