uri

package
v0.17.6-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasScheme

func HasScheme(scheme, rawuri string) bool

HasScheme returns true if the given uri has the given scheme, false otherwise.

Types

type URI

type URI struct {
	*url.URL
	Values url.Values
}

URI implements a parser for a URI format based on the the PKCS #11 URI Scheme defined in https://tools.ietf.org/html/rfc7512

These URIs will be used to define the key names in a KMS.

func New

func New(scheme string, values url.Values) *URI

New creates a new URI from a scheme and key-value pairs.

func NewFile

func NewFile(path string) *URI

NewFile creates an uri for a file.

func Parse

func Parse(rawuri string) (*URI, error)

Parse returns the URI for the given string or an error.

func ParseWithScheme

func ParseWithScheme(scheme, rawuri string) (*URI, error)

ParseWithScheme returns the URI for the given string only if it has the given scheme.

func (*URI) Get

func (u *URI) Get(key string) string

Get returns the first value in the uri with the given key, it will return empty string if that field is not present.

func (*URI) GetBool added in v0.17.5

func (u *URI) GetBool(key string) bool

GetBool returns true if a given key has the value "true". It returns false otherwise.

func (*URI) GetEncoded added in v0.15.7

func (u *URI) GetEncoded(key string) []byte

GetEncoded returns the first value in the uri with the given key, it will return empty nil if that field is not present or is empty. If the return value is hex encoded it will decode it and return it.

func (*URI) Pin added in v0.15.7

func (u *URI) Pin() string

Pin returns the pin encoded in the url. It will read the pin from the pin-value or the pin-source attributes.

Jump to

Keyboard shortcuts

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