Documentation
¶
Index ¶
- func AddListToSetString(set map[string]struct{}, list []string) map[string]struct{}
- func ExtractDomain(rawURL string, maxDomainLevel int) string
- func IsAbsoluteURL(u string) bool
- func IsSubdomain(base string, sub string) bool
- func IsURLAllowed(baseURL string, targetURL string, requireBaseURLMatch bool, ...) bool
- func MergeBodyParams(params1 []*discover.RouteBodyParam, params2 []*discover.RouteBodyParam) []*discover.RouteBodyParam
- func MergeQueryParams(params1 []*discover.RouteQueryParam, params2 []*discover.RouteQueryParam) []*discover.RouteQueryParam
- func MergeStaticAssets(staticAssets []string) []string
- func MergeWebRoutes(routes []*discover.RouteDetails) []*discover.RouteDetails
- func ParseBodyParams(postData string) ([]*discover.RouteBodyParam, error)
- func ParseQueryParams(reqURL *url.URL) []*discover.RouteQueryParam
- func ResolveURL(base, ref string) string
- func SetToListString(set map[string]struct{}) []string
- func URLRemoveQueryParams(rawURL string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddListToSetString ¶
AddListToSetString adds elements from a list of strings to a set of strings.
func ExtractDomain ¶
ExtractDomain extracts the domain from a URL up to a specified domain level.
func IsAbsoluteURL ¶
IsAbsoluteURL returns true if the given URL is absolute.
func IsSubdomain ¶
IsSubdomain checks if 'sub' is a subdomain of 'base'.
func IsURLAllowed ¶
func IsURLAllowed(baseURL string, targetURL string, requireBaseURLMatch bool, ignoreStaticAssets bool) bool
IsURLAllowed checks if a target URL is allowed based on base URL, static asset rules, and domain matching.
func MergeBodyParams ¶
func MergeBodyParams(params1 []*discover.RouteBodyParam, params2 []*discover.RouteBodyParam) []*discover.RouteBodyParam
MergeBodyParams merges two slices of RouteBodyParam, retaining unique params and merging example values.
func MergeQueryParams ¶
func MergeQueryParams(params1 []*discover.RouteQueryParam, params2 []*discover.RouteQueryParam) []*discover.RouteQueryParam
MergeQueryParams merges two slices of RouteQueryParam, retaining unique params and merging example values.
func MergeStaticAssets ¶
MergeStaticAssets merges static asset URLs, retaining only unique static assets.
func MergeWebRoutes ¶
func MergeWebRoutes(routes []*discover.RouteDetails) []*discover.RouteDetails
MergeWebRoutes merges WebRoutes, retaining only unique routes (by method and URL).
func ParseBodyParams ¶
func ParseBodyParams(postData string) ([]*discover.RouteBodyParam, error)
ParseBodyParams parses body parameters from a JSON or form-urlencoded string into RouteBodyParam structs.
func ParseQueryParams ¶
func ParseQueryParams(reqURL *url.URL) []*discover.RouteQueryParam
ParseQueryParams parses query parameters from a URL into RouteQueryParam structs.
func ResolveURL ¶
ResolveURL resolves a reference URL relative to a base URL.
func SetToListString ¶
SetToListString converts a set of strings to a list of strings.
func URLRemoveQueryParams ¶
URLRemoveQueryParams removes query parameters from a URL string.
Types ¶
This section is empty.