utils

package
v0.0.0-...-dd33a09 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SingleQuote = "SingleQuote"
	DoubleQuote = "DoubleQuote"
	Element     = "Element"
	Script      = "Script"
	Href        = "Href"
	Unknown     = "Unknown"
)
View Source
const (
	PathParam = iota
	QueryParam
)

Variables

View Source
var EscapeChecks = map[string]EscapeCheck{
	SingleQuote: {
		Checks: map[string]string{
			`'`:  `'`,
			`\'`: `\\'`,
		},
		MatchFunc: MatchSingleQuoteContext,
	},
	DoubleQuote: {
		Checks: map[string]string{
			`"`: `"`,
		},
		MatchFunc: MatchDoubleQuoteContext,
	},
	Element: {
		Checks: map[string]string{
			`<`: `<`,
		},
		MatchFunc: MatchElementContext,
	},
	Script: {
		Checks: map[string]string{
			`</`: `</`,
		},
		MatchFunc: MatchScriptContext,
	},
}

Functions

func FindMatchTypes

func FindMatchTypes(id string, body []byte) map[string]struct{}

func MatchAny

func MatchAny(value string, body []byte) bool

func MatchDoubleQuoteContext

func MatchDoubleQuoteContext(value string, body []byte) bool

func MatchElementContext

func MatchElementContext(value string, body []byte) bool

func MatchHrefAttribute

func MatchHrefAttribute(value string, body []byte) bool

func MatchScriptContext

func MatchScriptContext(value string, body []byte) bool

func MatchSingleQuoteContext

func MatchSingleQuoteContext(value string, body []byte) bool

func MiniUuid

func MiniUuid() string

Types

type EscapeCheck

type EscapeCheck struct {
	Checks    map[string]string
	MatchFunc Matcher
}

type Matcher

type Matcher func(string, []byte) bool

type Param

type Param struct {
	ParamType int
	ParamKey  string
	Index     int
}

func GetParams

func GetParams(target *url.URL) []Param

type RateLimitClient

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

func NewClient

func NewClient(headers map[string]string, rateLimit int, timeout int, verbose bool) *RateLimitClient

func (*RateLimitClient) Get

func (c *RateLimitClient) Get(url string) (*Response, error)

type Response

type Response struct {
	Status  int
	Headers http.Header
	Body    []byte
}

Jump to

Keyboard shortcuts

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