...

Package rulesfn

import "github.com/aws/smithy-go/endpoints/private/rulesfn"
Overview
Index

Overview ▾

func IsValidHostLabel

func IsValidHostLabel(input string, allowSubDomains bool) bool

IsValidHostLabel returns if the input is a single valid RFC 1123 host label. If allowSubDomains is true, will allow validation to include nested host labels. Returns false if the input is not a valid host label. If errors occur they will be added to the provided [ErrorCollector].

func SubString

func SubString(input string, start, stop int, reverse bool) *string

Substring returns the substring of the input provided. If the start or stop indexes are not valid for the input nil will be returned. If errors occur they will be added to the provided [ErrorCollector].

func URIEncode

func URIEncode(input string) string

URIEncode returns an percent-encoded RFC3986 section 2.1 version of the input string.

type URL

URL provides the structure describing the parts of a parsed URL returned by ParseURL.

type URL struct {
    Scheme         string // https://www.rfc-editor.org/rfc/rfc3986#section-3.1
    Authority      string // https://www.rfc-editor.org/rfc/rfc3986#section-3.2
    Path           string // https://www.rfc-editor.org/rfc/rfc3986#section-3.3
    NormalizedPath string // https://www.rfc-editor.org/rfc/rfc3986#section-6.2.3
    IsIp           bool
}

func ParseURL

func ParseURL(input string) *URL

ParseURL returns a URL if the provided string could be parsed. Returns nil if the string could not be parsed. Any parsing error will be added to the [ErrorCollector].

If the input URL string contains an IP6 address with a zone index. The returned [builtin.URL.Authority] value will contain the percent escaped (%) zone index separator.