Skip to content

Commit a423f79

Browse files
fix lint
1 parent eb1926e commit a423f79

1 file changed

Lines changed: 40 additions & 36 deletions

File tree

cmd/deskconn-router/main.go

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ const (
4242
topicAnswererOnCandidate = "io.xconn.webrtc.answerer.on_candidate"
4343

4444
desktopAuthRoleFormat = "xconnio:deskconn:desktop:%s"
45+
46+
matchPrefix = "prefix"
47+
matchExact = "exact"
48+
matchWildcard = "wildcard"
4549
)
4650

4751
type Authenticator struct {
@@ -173,37 +177,37 @@ func main() {
173177
Permissions: []xconn.Permission{
174178
{
175179
URI: "io.xconn.deskconn.",
176-
MatchPolicy: "prefix",
180+
MatchPolicy: matchPrefix,
177181
AllowRegister: true,
178182
},
179183
{
180184
URI: procedureAddRealm,
181-
MatchPolicy: "exact",
185+
MatchPolicy: matchExact,
182186
AllowCall: true,
183187
},
184188
{
185189
URI: procedureRemoveRealm,
186-
MatchPolicy: "exact",
190+
MatchPolicy: matchExact,
187191
AllowCall: true,
188192
},
189193
{
190194
URI: "io.xconn.deskconn.desktop.*.key.add",
191-
MatchPolicy: "wildcard",
195+
MatchPolicy: matchWildcard,
192196
AllowPublish: true,
193197
},
194198
{
195199
URI: "io.xconn.deskconn.desktop.*.key.remove",
196-
MatchPolicy: "wildcard",
200+
MatchPolicy: matchWildcard,
197201
AllowPublish: true,
198202
},
199203
{
200204
URI: "io.xconn.deskconn.desktop.*.detach",
201-
MatchPolicy: "wildcard",
205+
MatchPolicy: matchWildcard,
202206
AllowPublish: true,
203207
},
204208
{
205209
URI: "wamp.session.kill_by_authid",
206-
MatchPolicy: "exact",
210+
MatchPolicy: matchExact,
207211
AllowCall: true,
208212
},
209213
},
@@ -213,27 +217,27 @@ func main() {
213217
Permissions: []xconn.Permission{
214218
{
215219
URI: "io.xconn.deskconn.account.create",
216-
MatchPolicy: "exact",
220+
MatchPolicy: matchExact,
217221
AllowCall: true,
218222
},
219223
{
220224
URI: "io.xconn.deskconn.account.verify",
221-
MatchPolicy: "exact",
225+
MatchPolicy: matchExact,
222226
AllowCall: true,
223227
},
224228
{
225229
URI: "io.xconn.deskconn.account.otp.resend",
226-
MatchPolicy: "exact",
230+
MatchPolicy: matchExact,
227231
AllowCall: true,
228232
},
229233
{
230234
URI: "io.xconn.deskconn.account.password.forget",
231-
MatchPolicy: "exact",
235+
MatchPolicy: matchExact,
232236
AllowCall: true,
233237
},
234238
{
235239
URI: "io.xconn.deskconn.account.password.reset",
236-
MatchPolicy: "exact",
240+
MatchPolicy: matchExact,
237241
AllowCall: true,
238242
},
239243
},
@@ -243,7 +247,7 @@ func main() {
243247
Permissions: []xconn.Permission{
244248
{
245249
URI: "io.xconn.deskconn.app.update",
246-
MatchPolicy: "exact",
250+
MatchPolicy: matchExact,
247251
AllowCall: true,
248252
},
249253
},
@@ -253,47 +257,47 @@ func main() {
253257
Permissions: []xconn.Permission{
254258
{
255259
URI: "io.xconn.deskconn.organization.",
256-
MatchPolicy: "prefix",
260+
MatchPolicy: matchPrefix,
257261
AllowCall: true,
258262
},
259263
{
260264
URI: "io.xconn.deskconn.account.get",
261-
MatchPolicy: "exact",
265+
MatchPolicy: matchExact,
262266
AllowCall: true,
263267
},
264268
{
265269
URI: "io.xconn.deskconn.account.principal.",
266-
MatchPolicy: "prefix",
270+
MatchPolicy: matchPrefix,
267271
AllowCall: true,
268272
},
269273
{
270274
URI: "io.xconn.deskconn.account.update",
271-
MatchPolicy: "exact",
275+
MatchPolicy: matchExact,
272276
AllowCall: true,
273277
},
274278
{
275279
URI: "io.xconn.deskconn.account.delete",
276-
MatchPolicy: "exact",
280+
MatchPolicy: matchExact,
277281
AllowCall: true,
278282
},
279283
{
280284
URI: "io.xconn.deskconn.desktop.",
281-
MatchPolicy: "prefix",
285+
MatchPolicy: matchPrefix,
282286
AllowCall: true,
283287
},
284288
{
285289
URI: "io.xconn.deskconn.device.",
286-
MatchPolicy: "prefix",
290+
MatchPolicy: matchPrefix,
287291
AllowCall: true,
288292
},
289293
{
290294
URI: "io.xconn.deskconn.app.",
291-
MatchPolicy: "prefix",
295+
MatchPolicy: matchPrefix,
292296
AllowCall: true,
293297
},
294298
{
295299
URI: procedureCoturnCreate,
296-
MatchPolicy: "exact",
300+
MatchPolicy: matchExact,
297301
AllowCall: true,
298302
},
299303
},
@@ -392,27 +396,27 @@ func addRealm(router *xconn.Router, rlm string, authid string) error {
392396
Permissions: []xconn.Permission{
393397
{
394398
URI: "io.xconn.deskconn.deskconnd.",
395-
MatchPolicy: "prefix",
399+
MatchPolicy: matchPrefix,
396400
AllowRegister: true,
397401
},
398402
{
399403
URI: procedureWebRTCOffer,
400-
MatchPolicy: "exact",
404+
MatchPolicy: matchExact,
401405
AllowRegister: true,
402406
},
403407
{
404408
URI: topicAnswererOnCandidate,
405-
MatchPolicy: "exact",
409+
MatchPolicy: matchExact,
406410
AllowSubscribe: true,
407411
},
408412
{
409413
URI: topicOffererOnCandidate,
410-
MatchPolicy: "exact",
414+
MatchPolicy: matchExact,
411415
AllowPublish: true,
412416
},
413417
{
414418
URI: "wamp.session.on_leave",
415-
MatchPolicy: "exact",
419+
MatchPolicy: matchExact,
416420
AllowSubscribe: true,
417421
},
418422
},
@@ -422,22 +426,22 @@ func addRealm(router *xconn.Router, rlm string, authid string) error {
422426
Permissions: []xconn.Permission{
423427
{
424428
URI: "io.xconn.deskconn.deskconnd.",
425-
MatchPolicy: "prefix",
429+
MatchPolicy: matchPrefix,
426430
AllowCall: true,
427431
},
428432
{
429433
URI: procedureWebRTCOffer,
430-
MatchPolicy: "exact",
434+
MatchPolicy: matchExact,
431435
AllowCall: true,
432436
},
433437
{
434438
URI: topicAnswererOnCandidate,
435-
MatchPolicy: "exact",
439+
MatchPolicy: matchExact,
436440
AllowPublish: true,
437441
},
438442
{
439443
URI: topicOffererOnCandidate,
440-
MatchPolicy: "exact",
444+
MatchPolicy: matchExact,
441445
AllowSubscribe: true,
442446
},
443447
},
@@ -453,27 +457,27 @@ func addRealm(router *xconn.Router, rlm string, authid string) error {
453457
Permissions: []xconn.Permission{
454458
{
455459
URI: "io.xconn.deskconn.desktop.access.key.list",
456-
MatchPolicy: "exact",
460+
MatchPolicy: matchExact,
457461
AllowCall: true,
458462
},
459463
{
460464
URI: fmt.Sprintf("io.xconn.deskconn.desktop.%s.key.add", authid),
461-
MatchPolicy: "exact",
465+
MatchPolicy: matchExact,
462466
AllowSubscribe: true,
463467
},
464468
{
465469
URI: fmt.Sprintf("io.xconn.deskconn.desktop.%s.key.remove", authid),
466-
MatchPolicy: "exact",
470+
MatchPolicy: matchExact,
467471
AllowSubscribe: true,
468472
},
469473
{
470474
URI: fmt.Sprintf("io.xconn.deskconn.desktop.%s.detach", authid),
471-
MatchPolicy: "exact",
475+
MatchPolicy: matchExact,
472476
AllowSubscribe: true,
473477
},
474478
{
475479
URI: procedureCoturnCreate,
476-
MatchPolicy: "exact",
480+
MatchPolicy: matchExact,
477481
AllowCall: true,
478482
},
479483
},

0 commit comments

Comments
 (0)