Documentation ¶
Index ¶
- Variables
- func ClientIP(r *http.Request) string
- func GetDocumentFromURL(rawURL string, opts ...GetDocumentFromURLOption) ([]byte, error)
- func GetRequestHost(r *http.Request) string
- func GetRequestScheme(r *http.Request) string
- func GetRequestURI(r *http.Request) string
- func ParseCipherSuite(suiteName string) uint16
- func ParseTLSVersion(tlsVersionString string) uint16
- func ValidateDocumentURL(rawURL string) error
- type GetDocumentFromURLOption
- func WithAWSDisableSSL(disableSSL bool) GetDocumentFromURLOption
- func WithAWSEndpoint(endpoint string) GetDocumentFromURLOption
- func WithAWSRegion(region string) GetDocumentFromURLOption
- func WithAWSStaticCredentials(accessKey, secretKey, token string) GetDocumentFromURLOption
- func WithHTTPTimeout(timeout time.Duration) GetDocumentFromURLOption
Constants ¶
This section is empty.
Variables ¶
var NewLineMatcherRegex = regexp.MustCompile(`\r?\n`)
NewLineMatcherRegex Regex to remove all new lines.
Functions ¶
func GetDocumentFromURL ¶
func GetDocumentFromURL(rawURL string, opts ...GetDocumentFromURLOption) ([]byte, error)
GetDocumentFromURL retrieves a textual document from a URL, which may be an AWS ARN for an S3 object, Secrets Manager secret, or Systems Manager parameter (arn:...); an HTTP or HTTPS URL; an S3 URL in the form s3://bucket/key; or a file in URL or regular path form.
func GetRequestHost ¶
func GetRequestScheme ¶
func GetRequestURI ¶
func ParseCipherSuite ¶
ParseCipherSuite parses a cipher suite name into the tls package cipher suite id.
If the name is not recognized, 0 is returned.
func ParseTLSVersion ¶
ParseTLSVersion parses the TLS version number from a string. This accepts raw version numbers "1.0", "1.1", "1.2", "1.3". If the string is prefixed with "TLS ", "TLSv", "TLS-", or "TLS_" (case-insensitive), that prefix is removed. The decimal separator ('.') can be replaced with either a '_' or a '-'.
For example: "TLSv1.2", "TLS_1-2", "tls-1_2", "TLs 1-2", etc., are equivalent and return tls.VersionTLS12.
If the version number cannot be parsed, 0 is returned.
func ValidateDocumentURL ¶
ValidateDocumentURL verifies the document URL is supported.
If the URL is malformed, contains an unsupported scheme, or uses unsupported features (e.g. query arguments or fragments for AWS URLs), an error is returned.
Types ¶
type GetDocumentFromURLOption ¶
GetDocumentFromURLOption is a type alias for a function that can set various options to GetDocumentFromURL.
func WithAWSDisableSSL ¶
func WithAWSDisableSSL(disableSSL bool) GetDocumentFromURLOption
WithAWSDisableSSL is an option for GetDocumentFromURL to optionally disable SSL for requests.
func WithAWSEndpoint ¶
func WithAWSEndpoint(endpoint string) GetDocumentFromURLOption
WithAWSEndpoint is an option for GetDocumentFromURL to set the AWS service endpoint.
func WithAWSRegion ¶
func WithAWSRegion(region string) GetDocumentFromURLOption
WithAWSRegion is an option for GetDocumentFromURL to set the AWS region.
func WithAWSStaticCredentials ¶
func WithAWSStaticCredentials(accessKey, secretKey, token string) GetDocumentFromURLOption
WithAWSStaticCredentials is an option for GetDocumentFromURL to set AWS credentials.
func WithHTTPTimeout ¶
func WithHTTPTimeout(timeout time.Duration) GetDocumentFromURLOption
WithHTTPTimeout is an option for GetDocumentFromURL to set the HTTP timeout.