@@ -42,10 +42,6 @@ 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"
4945)
5046
5147type Authenticator struct {
@@ -177,37 +173,37 @@ func main() {
177173 Permissions : []xconn.Permission {
178174 {
179175 URI : "io.xconn.deskconn." ,
180- MatchPolicy : matchPrefix ,
176+ MatchPolicy : "prefix" ,
181177 AllowRegister : true ,
182178 },
183179 {
184180 URI : procedureAddRealm ,
185- MatchPolicy : matchExact ,
181+ MatchPolicy : "exact" ,
186182 AllowCall : true ,
187183 },
188184 {
189185 URI : procedureRemoveRealm ,
190- MatchPolicy : matchExact ,
186+ MatchPolicy : "exact" ,
191187 AllowCall : true ,
192188 },
193189 {
194190 URI : "io.xconn.deskconn.desktop.*.key.add" ,
195- MatchPolicy : matchWildcard ,
191+ MatchPolicy : "wildcard" ,
196192 AllowPublish : true ,
197193 },
198194 {
199195 URI : "io.xconn.deskconn.desktop.*.key.remove" ,
200- MatchPolicy : matchWildcard ,
196+ MatchPolicy : "wildcard" ,
201197 AllowPublish : true ,
202198 },
203199 {
204200 URI : "io.xconn.deskconn.desktop.*.detach" ,
205- MatchPolicy : matchWildcard ,
201+ MatchPolicy : "wildcard" ,
206202 AllowPublish : true ,
207203 },
208204 {
209205 URI : "wamp.session.kill_by_authid" ,
210- MatchPolicy : matchExact ,
206+ MatchPolicy : "exact" ,
211207 AllowCall : true ,
212208 },
213209 },
@@ -217,27 +213,27 @@ func main() {
217213 Permissions : []xconn.Permission {
218214 {
219215 URI : "io.xconn.deskconn.account.create" ,
220- MatchPolicy : matchExact ,
216+ MatchPolicy : "exact" ,
221217 AllowCall : true ,
222218 },
223219 {
224220 URI : "io.xconn.deskconn.account.verify" ,
225- MatchPolicy : matchExact ,
221+ MatchPolicy : "exact" ,
226222 AllowCall : true ,
227223 },
228224 {
229225 URI : "io.xconn.deskconn.account.otp.resend" ,
230- MatchPolicy : matchExact ,
226+ MatchPolicy : "exact" ,
231227 AllowCall : true ,
232228 },
233229 {
234230 URI : "io.xconn.deskconn.account.password.forget" ,
235- MatchPolicy : matchExact ,
231+ MatchPolicy : "exact" ,
236232 AllowCall : true ,
237233 },
238234 {
239235 URI : "io.xconn.deskconn.account.password.reset" ,
240- MatchPolicy : matchExact ,
236+ MatchPolicy : "exact" ,
241237 AllowCall : true ,
242238 },
243239 },
@@ -247,7 +243,7 @@ func main() {
247243 Permissions : []xconn.Permission {
248244 {
249245 URI : "io.xconn.deskconn.app.update" ,
250- MatchPolicy : matchExact ,
246+ MatchPolicy : "exact" ,
251247 AllowCall : true ,
252248 },
253249 },
@@ -257,47 +253,47 @@ func main() {
257253 Permissions : []xconn.Permission {
258254 {
259255 URI : "io.xconn.deskconn.organization." ,
260- MatchPolicy : matchPrefix ,
256+ MatchPolicy : "prefix" ,
261257 AllowCall : true ,
262258 },
263259 {
264260 URI : "io.xconn.deskconn.account.get" ,
265- MatchPolicy : matchExact ,
261+ MatchPolicy : "exact" ,
266262 AllowCall : true ,
267263 },
268264 {
269265 URI : "io.xconn.deskconn.account.principal." ,
270- MatchPolicy : matchPrefix ,
266+ MatchPolicy : "prefix" ,
271267 AllowCall : true ,
272268 },
273269 {
274270 URI : "io.xconn.deskconn.account.update" ,
275- MatchPolicy : matchExact ,
271+ MatchPolicy : "exact" ,
276272 AllowCall : true ,
277273 },
278274 {
279275 URI : "io.xconn.deskconn.account.delete" ,
280- MatchPolicy : matchExact ,
276+ MatchPolicy : "exact" ,
281277 AllowCall : true ,
282278 },
283279 {
284280 URI : "io.xconn.deskconn.desktop." ,
285- MatchPolicy : matchPrefix ,
281+ MatchPolicy : "prefix" ,
286282 AllowCall : true ,
287283 },
288284 {
289285 URI : "io.xconn.deskconn.device." ,
290- MatchPolicy : matchPrefix ,
286+ MatchPolicy : "prefix" ,
291287 AllowCall : true ,
292288 },
293289 {
294290 URI : "io.xconn.deskconn.app." ,
295- MatchPolicy : matchPrefix ,
291+ MatchPolicy : "prefix" ,
296292 AllowCall : true ,
297293 },
298294 {
299295 URI : procedureCoturnCreate ,
300- MatchPolicy : matchExact ,
296+ MatchPolicy : "exact" ,
301297 AllowCall : true ,
302298 },
303299 },
@@ -370,34 +366,17 @@ func main() {
370366 }
371367 fmt .Printf ("Registered procedure %s\n " , procedureRemoveRealm )
372368
373- yamuxAddress , ok := os .LookupEnv ("DESKCONN_ROUTER_YAMUX_ADDRESS" )
374- if ! ok || yamuxAddress == "" {
375- yamuxAddress = "0.0.0.0:8081"
376- }
377-
378- registry := newStreamBroker ()
379-
380369 server := xconn .NewServer (router , NewAuthenticator (session ), & xconn.ServerConfig {
381370 KeepAliveInterval : 30 * time .Second ,
382371 KeepAliveTimeout : 10 * time .Second ,
383372 })
384- server .SetYamuxConnHandler (registry .onDeviceConnect )
385- server .SetStreamHandler (registry .onClientStream )
386-
387373 listener , err := server .ListenAndServeWebSocket (xconn .NetworkTCP , address )
388374 if err != nil {
389375 log .Fatal (err )
390376 }
391- log .Printf ("listening websocket on %s" , listener .Addr ().String ())
377+ log .Printf ("listening on %s" , listener .Addr ().String ())
392378 defer listener .Close ()
393379
394- yamuxListener , err := server .ListenAndServeYamux (xconn .NetworkTCP , yamuxAddress )
395- if err != nil {
396- log .Fatal (err )
397- }
398- log .Printf ("listening yamux on %s" , yamuxListener .Addr ().String ())
399- defer yamuxListener .Close ()
400-
401380 // Close server if SIGINT (CTRL-c) received.
402381 closeChan := make (chan os.Signal , 1 )
403382 signal .Notify (closeChan , os .Interrupt )
@@ -413,27 +392,27 @@ func addRealm(router *xconn.Router, rlm string, authid string) error {
413392 Permissions : []xconn.Permission {
414393 {
415394 URI : "io.xconn.deskconn.deskconnd." ,
416- MatchPolicy : matchPrefix ,
395+ MatchPolicy : "prefix" ,
417396 AllowRegister : true ,
418397 },
419398 {
420399 URI : procedureWebRTCOffer ,
421- MatchPolicy : matchExact ,
400+ MatchPolicy : "exact" ,
422401 AllowRegister : true ,
423402 },
424403 {
425404 URI : topicAnswererOnCandidate ,
426- MatchPolicy : matchExact ,
405+ MatchPolicy : "exact" ,
427406 AllowSubscribe : true ,
428407 },
429408 {
430409 URI : topicOffererOnCandidate ,
431- MatchPolicy : matchExact ,
410+ MatchPolicy : "exact" ,
432411 AllowPublish : true ,
433412 },
434413 {
435414 URI : "wamp.session.on_leave" ,
436- MatchPolicy : matchExact ,
415+ MatchPolicy : "exact" ,
437416 AllowSubscribe : true ,
438417 },
439418 },
@@ -443,22 +422,22 @@ func addRealm(router *xconn.Router, rlm string, authid string) error {
443422 Permissions : []xconn.Permission {
444423 {
445424 URI : "io.xconn.deskconn.deskconnd." ,
446- MatchPolicy : matchPrefix ,
425+ MatchPolicy : "prefix" ,
447426 AllowCall : true ,
448427 },
449428 {
450429 URI : procedureWebRTCOffer ,
451- MatchPolicy : matchExact ,
430+ MatchPolicy : "exact" ,
452431 AllowCall : true ,
453432 },
454433 {
455434 URI : topicAnswererOnCandidate ,
456- MatchPolicy : matchExact ,
435+ MatchPolicy : "exact" ,
457436 AllowPublish : true ,
458437 },
459438 {
460439 URI : topicOffererOnCandidate ,
461- MatchPolicy : matchExact ,
440+ MatchPolicy : "exact" ,
462441 AllowSubscribe : true ,
463442 },
464443 },
@@ -474,27 +453,27 @@ func addRealm(router *xconn.Router, rlm string, authid string) error {
474453 Permissions : []xconn.Permission {
475454 {
476455 URI : "io.xconn.deskconn.desktop.access.key.list" ,
477- MatchPolicy : matchExact ,
456+ MatchPolicy : "exact" ,
478457 AllowCall : true ,
479458 },
480459 {
481460 URI : fmt .Sprintf ("io.xconn.deskconn.desktop.%s.key.add" , authid ),
482- MatchPolicy : matchExact ,
461+ MatchPolicy : "exact" ,
483462 AllowSubscribe : true ,
484463 },
485464 {
486465 URI : fmt .Sprintf ("io.xconn.deskconn.desktop.%s.key.remove" , authid ),
487- MatchPolicy : matchExact ,
466+ MatchPolicy : "exact" ,
488467 AllowSubscribe : true ,
489468 },
490469 {
491470 URI : fmt .Sprintf ("io.xconn.deskconn.desktop.%s.detach" , authid ),
492- MatchPolicy : matchExact ,
471+ MatchPolicy : "exact" ,
493472 AllowSubscribe : true ,
494473 },
495474 {
496475 URI : procedureCoturnCreate ,
497- MatchPolicy : matchExact ,
476+ MatchPolicy : "exact" ,
498477 AllowCall : true ,
499478 },
500479 },
0 commit comments