Documentation
¶
Index ¶
- Constants
- func AddCacheBuster(request []byte, cacheBuster string) []byte
- func AddOrReplaceHeader(request []byte, header string, value string) []byte
- func AppendToHeader(request []byte, header, value string) []byte
- func AppendToQuery(request []byte, suffix string) []byte
- func BasicEncodeParam(payload string) string
- func EnvTruthy(name string) bool
- func EscapeJSONString(input string) string
- func GenerateCanary() string
- func GetBodyStart(response []byte) int
- func GetCertificateFromHostname(host string) []string
- func GetExtensionOfPath(url string) string
- func GetFileByName(filename string) (string, error)
- func GetHeader(request []byte, header string) string
- func GetHeaderOffsets(request []byte, header string) []int
- func GetPathFromRequest(request []byte) string
- func IsBlank(value string) bool
- func IsMediaAndJSURL(url string) bool
- func IsMediaURL(url string) bool
- func IsNumeric(s string) bool
- func IsURL(input string) bool
- func MD5Enc(input string) string
- func MightBeFunction(value string) bool
- func MightBeIdentifier(value string) bool
- func MightBeOrderBy(name, value string) bool
- func RandomFromChoices(n int, choices string) string
- func RandomNumber(length int) string
- func RandomNumberInRange(from, to int) string
- func RandomString(length int) string
- func RandomUpper(s string) string
- func Replace(request []byte, find []byte, replace []byte) []byte
- func ReplaceFirst(request []byte, find []byte, replace []byte) []byte
- func SetHeader(request []byte, header string, value string) []byte
- func Sha1(input string) string
- func SplitPathRecursive(input string) []string
- func StringSliceContains(slice []string, item string) bool
- func StructToJsonString(item interface{}) string
- func Truthy(s string) bool
- func UnwrapError(err error) error
Constants ¶
const ( NUMBER_CHARSET = "123456789" // remove 0 to make sure it is not confused with O START_CHARSET = "ghijklmnopqrstuvwxyz" CHARSET = "0123456789abcdefghijklmnopqrstuvwxyz" HEX_CHARSET = "0123456789abcdef" )
Variables ¶
This section is empty.
Functions ¶
func AddCacheBuster ¶
func AddOrReplaceHeader ¶
func AppendToHeader ¶
func AppendToQuery ¶
func BasicEncodeParam ¶
func EnvTruthy ¶
EnvTruthy reads os.Getenv(name) through Truthy. Empty / unset / unrecognized returns false.
func EscapeJSONString ¶
func GenerateCanary ¶
func GenerateCanary() string
func GetBodyStart ¶
func GetExtensionOfPath ¶
func GetFileByName ¶
GetFileByName retrieves the content of a file from the embedded assets by its name.
func GetHeaderOffsets ¶
GetHeaderOffsets return the offsets of the headers in the request/response
the header name is case-insensitive
func GetPathFromRequest ¶
GetPathFromRequest returns the path from a request INCLUDE QUERY ALSO
func IsMediaAndJSURL ¶
IsMediaAndJSURL checks if a URL is a media or JS file return true if it is a media or JS file
func IsMediaURL ¶
func MightBeFunction ¶
func MightBeIdentifier ¶
MightBeIdentifier checks if the string is a possible identifier based on specific allowed characters
func MightBeOrderBy ¶
MightBeOrderBy checks if the given name or value suggests an 'order by' or 'sort' operation
func RandomFromChoices ¶
RandomFromChoices 从choices里面随机获取
func RandomNumber ¶
RandomNumber returns a random number with the specified length
func RandomNumberInRange ¶
func RandomString ¶
func RandomUpper ¶
func SplitPathRecursive ¶
func StringSliceContains ¶
StringSliceContains checks if a string slice contains a string.
func StructToJsonString ¶
func StructToJsonString(item interface{}) string
StructToJsonString renders item as indented JSON. Values that cannot be marshaled (channels, functions, cyclic refs) yield "" rather than panicking, since this is a best-effort display helper.
func Truthy ¶
Truthy reports whether s reads as a positive boolean flag — case-insensitive "1", "true", "yes", "on". Used for env-var and CLI-token parsing where the no/false form is conventionally absence.
func UnwrapError ¶
Types ¶
This section is empty.