discoverroute

package
v0.0.87 Latest Latest
Warning

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

Go to latest
Published: May 22, 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 helper function to extract the domain from a URL with an optional maxDomainLevel parameter maxDomainLevel specifies the number of domain levels to include in the extracted domain e.g. maxDomainLevel=2 would extract "example.com" from "www.sub.example.com" maxDomainLevel=0 would extract the full domain

func IsAbsoluteURL

func IsAbsoluteURL(u string) bool

IsAbsoluteURL helper function to check if a URL is absolute

func IsSubdomain

func IsSubdomain(base string, sub string) bool

IsSubdomain helper function to check if sub is a subdomain of base

func IsURLAllowed

func IsURLAllowed(baseURL string, targetURL string, requireBaseURLMatch bool, ignoreStaticAssets bool) bool

IsURLAllowed helper function to check if a URL is allowed based on baseUrlsOnly and base domain and captureStaticAssets This only checks the first subdomain only of the baseURL as a condition for match Web routes often get redirected to www.* or other subdomains, so we only check the base domain baseURL should be the original URL sent to the CLI, targetURL is the URL discovered that needs checking

func MergeBodyParams

func MergeBodyParams(params1 []*discover.RouteBodyParam, params2 []*discover.RouteBodyParam) []*discover.RouteBodyParam

MergeBodyParams helper function to merge BodyParams only retaining those that are unique When the same param name is encountered, the example values are merged

func MergeQueryParams

func MergeQueryParams(params1 []*discover.RouteQueryParam, params2 []*discover.RouteQueryParam) []*discover.RouteQueryParam

MergeQueryParams Helper function to merge QueryParams only retaining those that are unique When the same param name is encountered, the example values are merged

func MergeStaticAssets

func MergeStaticAssets(staticAssets []string) []string

MergeStaticAssets merges StaticAssets, retaining only unique static assets

func MergeWebRoutes

func MergeWebRoutes(routes []*discover.RouteDetails) []*discover.RouteDetails

MergeWebRoutes merges WebRoutes, retaining only unique routes unique routes are defined by the combination of method and URL

func ParseBodyParams

func ParseBodyParams(postData string) ([]*discover.RouteBodyParam, error)

ParseBodyParams helper function to parse body parameters

func ParseQueryParams

func ParseQueryParams(reqURL *url.URL) []*discover.RouteQueryParam

ParseQueryParams helper function to parse query parameters from the URL

func ResolveURL

func ResolveURL(base, ref string) string

ResolveURL helper function to resolve relative URLs

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 helper function to remove query parameters from a URL

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