mirror of
https://github.com/injoyai/tdx.git
synced 2025-11-26 21:25:35 +08:00
升级引用库版本
This commit is contained in:
9
go.mod
9
go.mod
@@ -5,9 +5,9 @@ go 1.20
|
|||||||
require (
|
require (
|
||||||
github.com/glebarez/go-sqlite v1.22.0
|
github.com/glebarez/go-sqlite v1.22.0
|
||||||
github.com/go-sql-driver/mysql v1.7.0
|
github.com/go-sql-driver/mysql v1.7.0
|
||||||
github.com/injoyai/base v1.0.18
|
github.com/injoyai/base v1.2.7
|
||||||
github.com/injoyai/conv v1.1.10
|
github.com/injoyai/conv v1.2.2
|
||||||
github.com/injoyai/ios v0.0.4
|
github.com/injoyai/ios v0.0.7
|
||||||
github.com/injoyai/logs v1.0.9
|
github.com/injoyai/logs v1.0.9
|
||||||
github.com/robfig/cron/v3 v3.0.1
|
github.com/robfig/cron/v3 v3.0.1
|
||||||
golang.org/x/text v0.16.0
|
golang.org/x/text v0.16.0
|
||||||
@@ -22,14 +22,13 @@ require (
|
|||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/google/uuid v1.5.0 // indirect
|
github.com/google/uuid v1.5.0 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/kr/text v0.2.0 // indirect
|
github.com/kr/pretty v0.3.1 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
|
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||||
github.com/satori/go.uuid v1.2.0 // indirect
|
|
||||||
github.com/stretchr/testify v1.9.0 // indirect
|
github.com/stretchr/testify v1.9.0 // indirect
|
||||||
github.com/syndtr/goleveldb v1.0.0 // indirect
|
github.com/syndtr/goleveldb v1.0.0 // indirect
|
||||||
golang.org/x/sys v0.22.0 // indirect
|
golang.org/x/sys v0.22.0 // indirect
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package protocol
|
package protocol
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"compress/zlib"
|
"compress/zlib"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/injoyai/base/bytes"
|
"github.com/injoyai/base/types"
|
||||||
"github.com/injoyai/base/g"
|
|
||||||
"github.com/injoyai/conv"
|
"github.com/injoyai/conv"
|
||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
@@ -19,7 +19,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Message interface {
|
type Message interface {
|
||||||
Bytes() g.Bytes
|
Bytes() types.Bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -39,7 +39,7 @@ type Frame struct {
|
|||||||
Data []byte //数据
|
Data []byte //数据
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Frame) Bytes() g.Bytes {
|
func (this *Frame) Bytes() types.Bytes {
|
||||||
length := uint16(len(this.Data) + 2)
|
length := uint16(len(this.Data) + 2)
|
||||||
data := make([]byte, 12+len(this.Data))
|
data := make([]byte, 12+len(this.Data))
|
||||||
data[0] = Prefix
|
data[0] = Prefix
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package protocol
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
bytes2 "github.com/injoyai/base/bytes"
|
|
||||||
"github.com/injoyai/conv"
|
"github.com/injoyai/conv"
|
||||||
"golang.org/x/text/encoding/simplifiedchinese"
|
"golang.org/x/text/encoding/simplifiedchinese"
|
||||||
"golang.org/x/text/transform"
|
"golang.org/x/text/transform"
|
||||||
@@ -15,12 +14,12 @@ import (
|
|||||||
|
|
||||||
// String 字节先转小端,再转字符
|
// String 字节先转小端,再转字符
|
||||||
func String(bs []byte) string {
|
func String(bs []byte) string {
|
||||||
return string(bytes2.Reverse(bs))
|
return string(Reverse(bs))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bytes 任意类型转小端字节
|
// Bytes 任意类型转小端字节
|
||||||
func Bytes(n any) []byte {
|
func Bytes(n any) []byte {
|
||||||
return bytes2.Reverse(conv.Bytes(n))
|
return Reverse(conv.Bytes(n))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reverse 字节倒序
|
// Reverse 字节倒序
|
||||||
@@ -34,12 +33,12 @@ func Reverse(bs []byte) []byte {
|
|||||||
|
|
||||||
// Uint32 字节通过小端方式转为uint32
|
// Uint32 字节通过小端方式转为uint32
|
||||||
func Uint32(bs []byte) uint32 {
|
func Uint32(bs []byte) uint32 {
|
||||||
return conv.Uint32(bytes2.Reverse(bs))
|
return conv.Uint32(Reverse(bs))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uint16 字节通过小端方式转为uint16
|
// Uint16 字节通过小端方式转为uint16
|
||||||
func Uint16(bs []byte) uint16 {
|
func Uint16(bs []byte) uint16 {
|
||||||
return conv.Uint16(bytes2.Reverse(bs))
|
return conv.Uint16(Reverse(bs))
|
||||||
}
|
}
|
||||||
|
|
||||||
func UTF8ToGBK(text []byte) []byte {
|
func UTF8ToGBK(text []byte) []byte {
|
||||||
|
|||||||
Reference in New Issue
Block a user