Skip to content

Commit b3efccd

Browse files
committed
updated
1 parent 7dd3bed commit b3efccd

File tree

3 files changed

+19
-24
lines changed

3 files changed

+19
-24
lines changed

go.mod

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@ go 1.19
44

55
require (
66
github.com/AspieSoft/go-regex-re2/v2 v2.0.8
7-
github.com/AspieSoft/goutil/v5 v5.3.5
7+
github.com/AspieSoft/goutil/compress/gzip v0.0.0-20230904214559-da8657ae1afb
8+
github.com/AspieSoft/goutil/crypt v0.0.0-20230904214559-da8657ae1afb
9+
github.com/AspieSoft/goutil/v7 v7.0.0
810
github.com/alphadose/haxmap v1.3.0
911
golang.org/x/net v0.14.0
1012
)
1113

1214
require (
1315
github.com/AspieSoft/go-syncterval v1.0.5 // indirect
1416
github.com/AspieSoft/go-ttlcache v1.2.2 // indirect
15-
github.com/andybalholm/brotli v1.0.5 // indirect
16-
github.com/cespare/go-smaz v1.0.0 // indirect
17-
github.com/fsnotify/fsnotify v1.6.0 // indirect
1817
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
1918
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
20-
golang.org/x/sys v0.12.0 // indirect
2119
)

go.sum

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,17 @@ github.com/AspieSoft/go-syncterval v1.0.5 h1:fzSNZofSX/7iBkLrWizMzGLGcBl3d+76cHy
44
github.com/AspieSoft/go-syncterval v1.0.5/go.mod h1:r+mTZPOWvfS0Y5YAxKINGNt8eX76i2Lib0VeqAw3SW4=
55
github.com/AspieSoft/go-ttlcache v1.2.2 h1:U6MMYY5PKANsB4/vhTiQsQ2U/y1P1yqMCxLw+qFNmCo=
66
github.com/AspieSoft/go-ttlcache v1.2.2/go.mod h1:czwXaDat1SKWGJDXkoMZWZFip97MXxuU0KzqJ9zVLDo=
7-
github.com/AspieSoft/goutil/v5 v5.3.5 h1:VZylkfwz8JsYWE0WQ79UniHCJShyyMQ2hdvXy0t6Bp0=
8-
github.com/AspieSoft/goutil/v5 v5.3.5/go.mod h1:iPHq44uDE4RfhgPPo+O8ieNOiylLQ0h/fVpFTw/EigY=
7+
github.com/AspieSoft/goutil/compress/gzip v0.0.0-20230904214559-da8657ae1afb h1:+zDS/ek1JH864TvB5OBoofNTXIPuAKbj1QKxbOrDIm8=
8+
github.com/AspieSoft/goutil/compress/gzip v0.0.0-20230904214559-da8657ae1afb/go.mod h1:3YENrWBz3uY2QhIiPVTSgPiqG3jKzxU+agXzgIY4c4E=
9+
github.com/AspieSoft/goutil/crypt v0.0.0-20230904214559-da8657ae1afb h1:Gymr95fbt5mhCWsbwi8xHqUJNs0baASOu1C0/4BTAl4=
10+
github.com/AspieSoft/goutil/crypt v0.0.0-20230904214559-da8657ae1afb/go.mod h1:44ZZF9lZe33LxoLDVlyRUyfTCcZ5v58k9idWrMvT3GM=
11+
github.com/AspieSoft/goutil/v7 v7.0.0 h1:r4brwFmKsemshfTvhxRBwlhg3LJLblBO5/6NtKOhIgg=
12+
github.com/AspieSoft/goutil/v7 v7.0.0/go.mod h1:ploAhabVCZ4MHcvGzHPummkxc/ZOQSjkScR9UYXK2KI=
913
github.com/alphadose/haxmap v1.3.0 h1:C/2LboOnPCZP27GmmSXOcwx360st0P8N0fTJ3voefKc=
1014
github.com/alphadose/haxmap v1.3.0/go.mod h1:rjHw1IAqbxm0S3U5tD16GoKsiAd8FWx5BJ2IYqXwgmM=
11-
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
12-
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
13-
github.com/cespare/go-smaz v1.0.0 h1:CUrrqIzakjINfWkdyNrVhtDKcGmdKkdB9AW7ke5nJ+M=
14-
github.com/cespare/go-smaz v1.0.0/go.mod h1:h77Hd4Dz/EPofhYvhkSuEyM0+6vyP3ckmSoBxTcKyxk=
15-
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
16-
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
1715
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
1816
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
1917
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ=
2018
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8=
2119
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
2220
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
23-
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
24-
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
25-
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

websocket.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import (
1010
"time"
1111

1212
"github.com/AspieSoft/go-regex-re2/v2"
13-
"github.com/AspieSoft/goutil/v5"
13+
"github.com/AspieSoft/goutil/v7"
14+
"github.com/AspieSoft/goutil/crypt"
15+
goutil_GZIP "github.com/AspieSoft/goutil/compress/gzip"
1416
"github.com/alphadose/haxmap"
1517
"golang.org/x/net/websocket"
1618
)
@@ -127,9 +129,9 @@ func (s *Server) handleWS(ws *websocket.Conn){
127129
}
128130

129131
clientID := s.clientUUID()
130-
token := string(goutil.Crypt.RandBytes(32))
131-
serverKey := string(goutil.Crypt.RandBytes(32))
132-
encKey := string(goutil.Crypt.RandBytes(64))
132+
token := string(crypt.RandBytes(32))
133+
serverKey := string(crypt.RandBytes(32))
134+
encKey := string(crypt.RandBytes(64))
133135

134136
client := Client{
135137
ws: ws,
@@ -559,15 +561,15 @@ func MsgType[T goutil.SupportedType] (msg interface{}) interface{} {
559561
}
560562

561563
func (s *Server) clientUUID() string {
562-
uuid := goutil.Crypt.RandBytes(s.uuidSize)
564+
uuid := crypt.RandBytes(s.uuidSize)
563565

564566
var hasID bool
565567
_, hasID = s.clients.Get(string(uuid))
566568

567569
loops := 1000
568570
for hasID && loops > 0 {
569571
loops--
570-
uuid = goutil.Crypt.RandBytes(s.uuidSize)
572+
uuid = crypt.RandBytes(s.uuidSize)
571573
_, hasID = s.clients.Get(string(uuid))
572574
}
573575

@@ -583,7 +585,7 @@ func gzip(b *[]byte) {
583585
if !GzipEnabled {
584586
return
585587
}
586-
if comp, err := goutil.GZIP.Zip(*b); err == nil {
588+
if comp, err := goutil_GZIP.Zip(*b); err == nil {
587589
*b = []byte(base64.StdEncoding.EncodeToString(comp))
588590
}
589591
}
@@ -593,7 +595,7 @@ func gunzip(b *[]byte) {
593595
return
594596
}
595597
if dec, err := base64.StdEncoding.DecodeString(string(*b)); err == nil {
596-
if dec, err = goutil.GZIP.UnZip(dec); err == nil {
598+
if dec, err = goutil_GZIP.UnZip(dec); err == nil {
597599
*b = dec
598600
}
599601
}

0 commit comments

Comments
 (0)