Documentation
¶
Index ¶
- Constants
- func Ceil[T constraints.Integer](a, b T) T
- func CeilUint64(a, b uint64) uint64
- func EncryptBytes(data []byte) string
- func GenTLSConfig() *tls.Config
- func GetObject(str []byte, v any) error
- func GetSockoptInt(fd uintptr, level, opt int) (int, error)
- func InitLog(level slog.Level, w io.Writer)
- func InitProcess()
- func IsBefore[T constraints.Integer](a, b, max T) bool
- func IsBefore8(a, b uint8) bool
- func IsBefore16(a, b uint16) bool
- func IsBefore32(a, b uint32) bool
- func IsBefore64(a, b uint64) bool
- func ReadStream(stream *quic.Stream, length uint64) ([]byte, error)
- func ReadStreamByHeaderType(stream *quic.Stream, headerType HeaderType) ([]byte, error)
- func ReadStreamByHeaderUShort(stream *quic.Stream) ([]byte, error)
- func ReadStreamFull(stream *quic.Stream, length uint64) ([]byte, error)
- func ReadStreamWithTimeout(stream *quic.Stream, length uint64, timeout time.Duration) ([]byte, error)
- func SetSocketReuse(fd uintptr)
- func SetSockoptInt(fd uintptr, level, opt int, value int) (err error)
- func SetSockoptMin(fd uintptr, level, opt int, value int) (err error)
- func ToJsonByte(v any) ([]byte, error)
- func ToJsonString(v any) (string, error)
- func WriteStream(stream *quic.Stream, header, payload []byte) error
- func WriteStreamByHeaderType(stream *quic.Stream, data []byte, headerType HeaderType) error
- func WriteStreamByHeaderUShort(stream *quic.Stream, data []byte) error
- type HeaderType
- type JsonArray
- type JsonObject
- type StreamResult
Constants ¶
View Source
const ( UShort HeaderType = 2 UInt = 4 ULong = 8 )
Variables ¶
This section is empty.
Functions ¶
func EncryptBytes ¶
func GenTLSConfig ¶
func InitProcess ¶
func InitProcess()
func ReadStream ¶
ReadStream 从数据流中读取数据包,在接收完流的指定长度前不会返回
func ReadStreamByHeaderType ¶
func ReadStreamByHeaderType(stream *quic.Stream, headerType HeaderType) ([]byte, error)
ReadStreamByHeaderType 从数据流中读取数据包,数据包的长度又类型提供简单的支持,且未接收完流前不会返回
func ReadStreamByHeaderUShort ¶
ReadStreamByHeaderUShort 从数据流中读取数据包,数据包长度类型为uint16,且未接收完流前不会返回
func ReadStreamFull ¶
ReadStreamFull 从数据流中读取数据包,在接收完流的指定长度前不会返回
func ReadStreamWithTimeout ¶
func ReadStreamWithTimeout(stream *quic.Stream, length uint64, timeout time.Duration) ([]byte, error)
ReadStreamWithTimeout 从数据流中读取数据包,在接收完流的指定长度前不会返回
func SetSocketReuse ¶
func SetSocketReuse(fd uintptr)
func WriteStream ¶
WriteStream 将数据包写入数据流,数据包包含数据头和载体,数据头允许为空
func WriteStreamByHeaderType ¶
func WriteStreamByHeaderType(stream *quic.Stream, data []byte, headerType HeaderType) error
WriteStreamByHeaderType 将数据写入数据流,同时携带数据包长度作为报头,数据包长度类型根据输入headerType进行指定
Types ¶
type StreamResult ¶
type StreamResult struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.