utils

package module
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 36 Imported by: 3

README

go-utils

Documentation

Index

Constants

View Source
const (
	Version     = "124"
	UserAgent   = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/" + Version + ".0.0.0 Safari/537.36"
	SecChUa     = "\"Chromium\";v=\"124\", \"Google Chrome\";v=\"124\", \"Not-A.Brand\";v=\"99\""
	BrowserName = "Chrome"
	DeviceType  = "Desktop"
	OsName      = "Windows"
	OsVersion   = "10"
)

Variables

This section is empty.

Functions

func CleanAddress

func CleanAddress(address string) string

func Compress

func Compress(uncompressed string, keyStrBase64 string) string

func Contains

func Contains(s []string, e string) bool

func ContainsInt

func ContainsInt(s []int, e int) bool

func ContainsInt16

func ContainsInt16(s []int16, e int16) bool

func ContainsInt32

func ContainsInt32(s []int32, e int32) bool

func ContainsInt64

func ContainsInt64(s []int64, e int64) bool

func ContainsInt8

func ContainsInt8(s []int8, e int8) bool

func ContainsUint

func ContainsUint(s []uint, e uint) bool

func ContainsUint16

func ContainsUint16(s []uint16, e uint16) bool

func ContainsUint32

func ContainsUint32(s []uint32, e uint32) bool

func ContainsUint64

func ContainsUint64(s []uint64, e uint64) bool

func ContainsUint8

func ContainsUint8(s []uint8, e uint8) bool

func Decompress

func Decompress(input string, keyStrBase64 string) (string, error)

func DecompressBody

func DecompressBody(Body []byte, encoding string) (parsedBody []byte)

DecompressBody unzips compressed data

func DecryptAES

func DecryptAES(key []byte, ct []byte) []byte

func DeflateData

func DeflateData(data []byte) (resData []byte, err error)

func EncryptAES

func EncryptAES(key []byte, plaintext string) []byte

func EnflateData

func EnflateData(data []byte) (resData []byte, err error)

func EscapeQuotes

func EscapeQuotes(str string) string

func FormatProxy

func FormatProxy(proxy string) string

func GUnzipData

func GUnzipData(data []byte) (resData []byte, err error)

func GenerateRandomString

func GenerateRandomString(length uint8) string

func GetHashOf

func GetHashOf(text string) string

func GetHashOfWithSalt

func GetHashOfWithSalt(text, salt string, timestamp int) string

func GetHeaderAndOrder

func GetHeaderAndOrder(t HeaderType, referer *url.URL, additional ...[2]string) (header http.Header, order []string)

func GetHexString

func GetHexString(length int) string

func GetID

func GetID() string

func GetIP

func GetIP(r *http.Request) string

func GetLastChromeVersion

func GetLastChromeVersion() *tls.ClientHelloSpec

GetLastChromeVersion apply the latest Chrome version Current Chrome version : 111

func GetRandomChromeUserAgent

func GetRandomChromeUserAgent(minVer, maxVer int) (string, string)

func GetRequestBody

func GetRequestBody(request *http.Request) []byte

func GetResponseBody

func GetResponseBody(response *http.Response) []byte

func GetSecChUa

func GetSecChUa(version int) string

func GetTime

func GetTime() int64

func JsonDumps

func JsonDumps(obj interface{}) string

func JsonDumpsBytes

func JsonDumpsBytes(obj interface{}) []byte

func Must

func Must(a any, e error) any

func NewSHA256

func NewSHA256(data string) string

func Removes

func Removes(s []string, i int) []string

func RemovesWithOrder

func RemovesWithOrder(s []string, i int) []string

func ReturnWeb

func ReturnWeb(success any) []byte

func ReturnWebError

func ReturnWebError(error string) []byte

func SafeGoRoutine

func SafeGoRoutine(fn func(), recoverFns ...func())

func UnBrotliData

func UnBrotliData(data []byte) (resData []byte, err error)

func UrlEncode

func UrlEncode(obj any) string

func UrlEncodeMap

func UrlEncodeMap(query map[string]string) string

Types

type HeaderType

type HeaderType uint8
const (
	DefaultHeaders HeaderType = iota
)

type Oauth2

type Oauth2 struct {
	// contains filtered or unexported fields
}

func NewOauth2

func NewOauth2() *Oauth2

func (*Oauth2) GenerateCodeVerifier

func (o *Oauth2) GenerateCodeVerifier(length uint8)

func (*Oauth2) GetCodeChallenge

func (o *Oauth2) GetCodeChallenge() string

func (*Oauth2) GetCodeChallengeMethod

func (o *Oauth2) GetCodeChallengeMethod() string

func (*Oauth2) GetCodeVerifier

func (o *Oauth2) GetCodeVerifier() string

func (*Oauth2) GetNonce

func (o *Oauth2) GetNonce() string

func (*Oauth2) GetState

func (o *Oauth2) GetState() string

type OrderedMap

type OrderedMap struct {
	Order []string
	Map   map[string]any
}

func (OrderedMap) MarshalJSON

func (om OrderedMap) MarshalJSON() ([]byte, error)

func (*OrderedMap) UnmarshalJSON

func (om *OrderedMap) UnmarshalJSON(b []byte) error

type OrderedQuery

type OrderedQuery struct {
	// contains filtered or unexported fields
}

func (*OrderedQuery) Add

func (oq *OrderedQuery) Add(key string, value string)

func (*OrderedQuery) String

func (oq *OrderedQuery) String() string

type SuccessInitSensor

type SuccessInitSensor struct {
	Success bool   `json:"success"`
	Id      string `json:"id"`
}

type SuccessReturn

type SuccessReturn struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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