utils

package module
v0.0.0-...-ea68a16 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: MIT Imports: 19 Imported by: 1

README

utils

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecryptCBC

func AesDecryptCBC(encrypted []byte, key []byte) (decrypted []byte)

func AesDecryptCBCIV

func AesDecryptCBCIV(encrypted []byte, key, iv []byte) (decrypted []byte)

func AesDecryptCFB

func AesDecryptCFB(encrypted []byte, key []byte) (decrypted []byte)

func AesDecryptECB

func AesDecryptECB(encrypted []byte, key []byte) (decrypted []byte)

func AesEncryptCBC

func AesEncryptCBC(origData []byte, key []byte) (encrypted []byte)

=================== CBC ======================

func AesEncryptCBCIV

func AesEncryptCBCIV(origData []byte, key, iv []byte) (encrypted []byte)

func AesEncryptCFB

func AesEncryptCFB(origData []byte, key []byte) (encrypted []byte)

=================== CFB ======================

func AesEncryptECB

func AesEncryptECB(origData []byte, key []byte) (encrypted []byte)

=================== ECB ======================

func Base64Decode

func Base64Decode(data string) []byte

func Base64Encode

func Base64Encode(data []byte) string

func BytesToUint16

func BytesToUint16(in []byte) uint16

func BytesToUint16s

func BytesToUint16s(in []byte) (out []uint16)

func BytesToUint32

func BytesToUint32(in []byte) uint32

func BytesToUint32s

func BytesToUint32s(in []byte) (out []uint32)

func Get

func Get[T any](url string) (*T, error)

func GetHeader

func GetHeader[T any](url string, h map[string]string) (*T, error)

func LoadConfig

func LoadConfig[T Config[T]]() (*T, error)

func LoadConfigReader

func LoadConfigReader[T Config[T]](reader io.Reader) (*T, error)

func MD5

func MD5(s string) string

func Post

func Post[T any](url string, data any) (*T, error)

func PostHeader

func PostHeader[T any](url string, data any, h map[string]string) (*T, error)

func RandString

func RandString(n int) string

func SHA

func SHA(s string) string

func TimeID

func TimeID() string

func Uint16ToBytes

func Uint16ToBytes(in uint16) (out []byte)

func Uint32ToBytes

func Uint32ToBytes(in uint32) (out []byte)

Types

type AppKey

type AppKey struct {
	Appkey     string   `json:"appkey"     yaml:"appkey"`
	Secret     string   `json:"secret"     yaml:"secret"`
	Permission []string `json:"permission" yaml:"permission"`
}

type BaseConfig

type BaseConfig struct {
	Listen string
	Mode   string
}

func (BaseConfig) Release

func (b BaseConfig) Release() bool

type Config

type Config[T any] interface {
	Release() bool
}

Directories

Path Synopsis
ex

Jump to

Keyboard shortcuts

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