tools

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2025 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Aes = &xAes{}
View Source
var Bytes = &xBytes{}
View Source
var DecryptError = errors.New("aes decrypt error")
View Source
var Error = &xError{}
View Source
var File = &xFile{}
View Source
var Http = &xHttp{}
View Source
var Json = &xJson{}
View Source
var Map = &xMap{}
View Source
var Number = &xNumber{}
View Source
var Proto = &xProto{}
View Source
var Pwd = &xPwd{}
View Source
var Random = &xRandom{}
View Source
var Regex = &xRegex{}
View Source
var Retry = xRetry{}
View Source
var Sdp = &xSdp{}
View Source
var Snowflake *xSnowflake
View Source
var String = &xString{}
View Source
var Time = &xTime{}
View Source
var Trace = &xTrace{}

Functions

func AnyInSlice

func AnyInSlice[T AnyInSliceType](v T, slice []T) bool

func AnyPtr

func AnyPtr[T any](v T) *T

func AnySet

func AnySet[T AnyInSliceType](list []T) []T

func AnyString

func AnyString(o any) string

func EnumInSlice

func EnumInSlice[T EnumInSliceType](v T, slice []T) bool

func GetECDHSecret

func GetECDHSecret(privateKey, publicKey string) (string, error)

GetECDHSecret 使用自己的私钥和别人的公钥(hex),协商密钥

func GetPodIp

func GetPodIp() string

func Md5

func Md5(s string) string

func Md5Bytes

func Md5Bytes(b []byte) string

func Md516

func Md516(s string) string

Types

type AnyInSliceType

type AnyInSliceType interface {
	string | int8 | int16 | int32 | int64 | int | uint8 | uint16 | uint32 | uint64 | uint | float32 | float64 | bool
}

type ECDH

type ECDH interface {
	// GenerateKey 生成公私钥对
	GenerateKey(io.Reader) (crypto.PrivateKey, crypto.PublicKey, error)
	// Marshal 将公钥转换为字节
	Marshal(crypto.PublicKey) []byte
	// Unmarshal 将字节转换为公钥
	Unmarshal([]byte) (crypto.PublicKey, bool)
	// GenerateSharedSecret 生成共享密钥
	GenerateSharedSecret(crypto.PrivateKey, crypto.PublicKey) ([]byte, error)
	// HexEncodePublicKeyToString 将公钥钥转换为hex字符串
	HexEncodePublicKeyToString(crypto.PublicKey) string
	// HexEncodePrivateKeyToString 将私钥转换为hex字符串
	HexEncodePrivateKeyToString(crypto.PrivateKey) string
}

ECDH The main interface for ECDH key exchange.

func NewECDH

func NewECDH(curve elliptic.Curve) ECDH

NewECDH creates a new instance of ECDH with the given elliptic.Curve curve to use as the elliptical curve for elliptical curve diffie-hellman.

type EnumInSliceType

type EnumInSliceType interface {
	String() string
}

type SSM

type SSM map[string]string

func NewSSMFromBsonM

func NewSSMFromBsonM(m bson.M) SSM

func (SSM) Get

func (ssm SSM) Get(k string) string

func (SSM) GetInt64

func (ssm SSM) GetInt64(k string) int64

func (SSM) GetOrDefault

func (ssm SSM) GetOrDefault(k string, def string) string

func (SSM) Marshal

func (ssm SSM) Marshal() string

func (SSM) ToSA

func (ssm SSM) ToSA() map[string]any

func (SSM) ToSS

func (ssm SSM) ToSS() map[string]string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL