Skip to content

Commit feac045

Browse files
Merge pull request #1 from xconnio/init-project
Init project
2 parents 917827e + 4c3e965 commit feac045

7 files changed

Lines changed: 295 additions & 1 deletion

File tree

.github/workflows/main.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: deskconn router CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v6
17+
18+
- name: Setup go
19+
uses: actions/setup-go@v6
20+
with:
21+
go-version-file: 'go.mod'
22+
cache: true
23+
- run: go version
24+
25+
- name: Pull in all Go dependencies
26+
run: go mod vendor
27+
28+
- name: golangci-lint
29+
uses: golangci/golangci-lint-action@v9
30+
with:
31+
version: latest
32+
skip-pkg-cache: true
33+
skip-build-cache: true
34+
35+
- name: Check that code is formatted via go fmt tool
36+
run: |
37+
if [ "$(gofmt -s -l . | grep -v vendor | wc -l)" -gt 0 ]; then
38+
exit 1;
39+
fi
40+
41+
- name: Check that go modules are in synced state
42+
run: |
43+
go mod tidy -v
44+
if [ -n "$(git status --porcelain go.mod go.sum)" ]; then
45+
echo "Go modules are dirty or not in a good state. Please run go mod tidy"
46+
exit 1;
47+
fi
48+
49+
- name: Run unit tests
50+
run: make test

.golangci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
version: "2"
2+
run:
3+
tests: true
4+
allow-parallel-runners: false
5+
output:
6+
path-prefix: ""
7+
linters:
8+
default: none
9+
enable:
10+
- asciicheck
11+
- bidichk
12+
- contextcheck
13+
- decorder
14+
- durationcheck
15+
- errcheck
16+
- errorlint
17+
- gochecknoglobals
18+
- goconst
19+
- godot
20+
- gosec
21+
- govet
22+
- ineffassign
23+
- lll
24+
- misspell
25+
- nakedret
26+
- nilerr
27+
- staticcheck
28+
- testpackage
29+
- unconvert
30+
- unparam
31+
- unused
32+
exclusions:
33+
generated: lax
34+
presets:
35+
- comments
36+
- common-false-positives
37+
- legacy
38+
- std-error-handling
39+
rules:
40+
- linters:
41+
- dupl
42+
- errcheck
43+
- gocyclo
44+
- gosec
45+
path: _test\.go
46+
- linters:
47+
- gochecknoglobals
48+
- testpackage
49+
path: export.*_test\.go
50+
- linters:
51+
- unparam
52+
- unused
53+
path: benchmarks/*
54+
- linters:
55+
- unused
56+
path: examples/(serializers|authentications)\.go
57+
- linters:
58+
- errcheck
59+
text: .AbortWithReason
60+
paths:
61+
- third_party$
62+
- builtin$
63+
- examples$
64+
issues:
65+
max-same-issues: 0
66+
new: false
67+
formatters:
68+
enable:
69+
- gci
70+
- gofmt
71+
settings:
72+
gci:
73+
sections:
74+
- standard
75+
- default
76+
- prefix(github.com/xconnio)
77+
custom-order: true
78+
exclusions:
79+
generated: lax
80+
paths:
81+
- third_party$
82+
- builtin$
83+
- examples$

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 XConn
3+
Copyright (c) 2025 XConnIO Ltd.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
test:
2+
go test -count=1 ./... -v
3+
4+
lint:
5+
golangci-lint run
6+
7+
build:
8+
go build github.com/xconnio/deskconn-router/cmd/deskconn-router
9+
10+
run:
11+
go run github.com/xconnio/deskconn-router/cmd/deskconn-router

cmd/deskconn-router/main.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package main
2+
3+
import (
4+
"os"
5+
"os/signal"
6+
7+
log "github.com/sirupsen/logrus"
8+
9+
"github.com/xconnio/xconn-go"
10+
)
11+
12+
func main() {
13+
router, err := xconn.NewRouter(xconn.DefaultRouterConfig())
14+
if err != nil {
15+
log.Fatal(err)
16+
}
17+
18+
err = router.AddRealm("realm1", &xconn.RealmConfig{
19+
AutoDiscloseCaller: true,
20+
Roles: []xconn.RealmRole{
21+
{
22+
Name: "anonymous",
23+
Permissions: []xconn.Permission{
24+
{
25+
URI: "io.xconn.",
26+
MatchPolicy: "prefix",
27+
AllowCall: true,
28+
AllowRegister: true,
29+
},
30+
},
31+
},
32+
},
33+
})
34+
if err != nil {
35+
log.Fatal(err)
36+
}
37+
38+
server := xconn.NewServer(router, nil, &xconn.ServerConfig{})
39+
listener, err := server.ListenAndServeWebSocket(xconn.NetworkTCP, "0.0.0.0:8080")
40+
if err != nil {
41+
log.Fatal(err)
42+
}
43+
log.Printf("listening on %s", listener.Addr().String())
44+
defer listener.Close()
45+
46+
// Close server if SIGINT (CTRL-c) received.
47+
closeChan := make(chan os.Signal, 1)
48+
signal.Notify(closeChan, os.Interrupt)
49+
<-closeChan
50+
}

go.mod

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module github.com/xconnio/deskconn-router
2+
3+
go 1.22
4+
5+
require (
6+
github.com/sirupsen/logrus v1.9.3
7+
github.com/xconnio/xconn-go v0.0.0-20251108143232-364781a4f29a
8+
)
9+
10+
require (
11+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
12+
github.com/go-ole/go-ole v1.2.6 // indirect
13+
github.com/gobwas/httphead v0.1.0 // indirect
14+
github.com/gobwas/pool v0.2.1 // indirect
15+
github.com/gobwas/ws v1.4.0 // indirect
16+
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect
17+
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
18+
github.com/projectdiscovery/ratelimit v0.0.50 // indirect
19+
github.com/projectdiscovery/utils v0.2.3 // indirect
20+
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
21+
github.com/tklauser/go-sysconf v0.3.12 // indirect
22+
github.com/tklauser/numcpus v0.6.1 // indirect
23+
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
24+
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
25+
github.com/x448/float16 v0.8.4 // indirect
26+
github.com/xconnio/wampproto-go v0.0.0-20251105154130-632905d8a3d9 // indirect
27+
github.com/yusufpapurcu/wmi v1.2.4 // indirect
28+
golang.org/x/crypto v0.33.0 // indirect
29+
golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d // indirect
30+
golang.org/x/sys v0.30.0 // indirect
31+
golang.org/x/time v0.5.0 // indirect
32+
)

go.sum

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
4+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5+
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
6+
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
7+
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
8+
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
9+
github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU=
10+
github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
11+
github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og=
12+
github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
13+
github.com/gobwas/ws v1.4.0 h1:CTaoG1tojrh4ucGPcoJFiAQUAsEWekEWvLy7GsVNqGs=
14+
github.com/gobwas/ws v1.4.0/go.mod h1:G3gNqMNtPppf5XUz7O4shetPpcZ1VJ7zt18dlUeakrc=
15+
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 h1:CUW5RYIcysz+D3B+l1mDeXrQ7fUvGGCwJfdASSzbrfo=
16+
github.com/hashicorp/go-immutable-radix/v2 v2.1.0/go.mod h1:hgdqLXA4f6NIjRVisM1TJ9aOJVNRqKZj+xDGF6m7PBw=
17+
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
18+
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
19+
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
20+
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
21+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
22+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
23+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
24+
github.com/projectdiscovery/ratelimit v0.0.50 h1:33uzpi9DLzhQEC8Erfo3LWSzvlVcpCwrKNlYaxclllo=
25+
github.com/projectdiscovery/ratelimit v0.0.50/go.mod h1:FxoAGNVkZMXwETUd9NS7bVxm65HQrAya1yXiX+/Vuwk=
26+
github.com/projectdiscovery/utils v0.2.3 h1:rkambl0EoTF/y6DpjCfSwcVUFdkAeVOtYkK3lX6InCY=
27+
github.com/projectdiscovery/utils v0.2.3/go.mod h1:eGuuQ5Acekg47WsFS1Q9Qxw8+vI6IxwqIQSAplBBG0c=
28+
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
29+
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
30+
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
31+
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
32+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
33+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
34+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
35+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
36+
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
37+
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
38+
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
39+
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
40+
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
41+
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
42+
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
43+
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
44+
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
45+
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
46+
github.com/xconnio/wampproto-go v0.0.0-20251105154130-632905d8a3d9 h1:2eGfp79Yjj8gf1uNONKVp9FG5U/XhcoAaT1p6kbNJRU=
47+
github.com/xconnio/wampproto-go v0.0.0-20251105154130-632905d8a3d9/go.mod h1:k2I4x+dOyJq5XW6SHbnwrqJEuRf/lO9rbF5habINuMM=
48+
github.com/xconnio/xconn-go v0.0.0-20251108143232-364781a4f29a h1:Yj50wOwocWtMZZ7marGK0s1NsRlhZIC1C2sk4xBDX8w=
49+
github.com/xconnio/xconn-go v0.0.0-20251108143232-364781a4f29a/go.mod h1:8tnNmQgOIlEqF/QesbPQMP2NeI42LP/6lIJG6vq4TwQ=
50+
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
51+
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
52+
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
53+
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
54+
golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d h1:N0hmiNbwsSNwHBAvR3QB5w25pUwH4tK0Y/RltD1j1h4=
55+
golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
56+
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
57+
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
58+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
59+
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
60+
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
61+
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
62+
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
63+
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
64+
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
65+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
66+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
67+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
68+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)