discoverroute

package
v0.0.107 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddListToSetString

func AddListToSetString(set map[string]struct{}, list []string) map[string]struct{}

AddListToSetString adds elements from a list of strings to a set of strings.

func ExtractDomain

func ExtractDomain(rawURL string, maxDomainLevel int) string

ExtractDomain extracts the domain from a URL up to a specified domain level.

func IsAbsoluteURL

func IsAbsoluteURL(u string) bool

IsAbsoluteURL returns true if the given URL is absolute.

func IsSubdomain

func IsSubdomain(base string, sub string) bool

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

func MergeStaticAssets(staticAssets []string) []string

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

func ResolveURL(base, ref string) string

ResolveURL resolves a reference URL relative to a base URL.

func SetToListString

func SetToListString(set map[string]struct{}) []string

SetToListString converts a set of strings to a list of strings.

func URLRemoveQueryParams

func URLRemoveQueryParams(rawURL string) (string, error)

URLRemoveQueryParams removes query parameters from a URL string.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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