href

package module
v0.0.0-...-0f8fd3d Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

README

href

A NSFW Go implementation of the Constrained Resource Identifiers spec.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SchemeIDtoString

func SchemeIDtoString(schemeID int64) string

Types

type Authority

type Authority struct {
	Host   Host
	Port   Port
	IsNull bool // no authority, leading slash
	IsTrue bool // no authority, no slash
}

func (*Authority) IsSet

func (o *Authority) IsSet() bool

func (*Authority) Set

func (o *Authority) Set(val interface{}) error

func (*Authority) SetHostPort

func (o *Authority) SetHostPort(val []interface{}) error

func (*Authority) SetNull

func (o *Authority) SetNull()

func (*Authority) SetTrue

func (o *Authority) SetTrue()

func (Authority) String

func (o Authority) String() string

type CRI

type CRI struct {
	Discard   Discard
	Scheme    Scheme
	Authority Authority
	Path      Path
	Query     Query
	Fragment  Fragment
}

func Parse

func Parse(rawCRI []byte) (*CRI, error)

Parse ingest a CRI Reference in transfer form into its abstract form

func (*CRI) IsAbs

func (o *CRI) IsAbs() bool

func (CRI) ResolveReference

func (o CRI) ResolveReference(ref *CRI) *CRI

ResolveReference resolves a CRI reference to an absolute CRI from an absolute base CRI o, per href-09 Section 5.3. The CRI reference may be relative or absolute. ResolveReference always returns a new CRI instance, even if the returned CRI is identical to either the base or reference. If ref is an absolute CRI, then ResolveReference ignores base and returns a copy of ref.

func (*CRI) ToCBOR

func (o *CRI) ToCBOR() ([]byte, error)

func (*CRI) ToURI

func (o *CRI) ToURI() (*url.URL, error)

ToURI convert a CRI reference to a URI reference by determining the components of the URI reference according to the steps in §6.1 of href-09 and then recomposing the components to a URI reference string as specified in §5.3 of RFC3986.

type Discard

type Discard struct {
	// contains filtered or unexported fields
}

func (Discard) ComputePathPrefix

func (o Discard) ComputePathPrefix() string

TODO(tho) handle failure condition "discard==0 && path item present"

func (Discard) Get

func (o Discard) Get() interface{}

func (Discard) IsSet

func (o Discard) IsSet() bool

func (Discard) IsTrue

func (o Discard) IsTrue() bool

func (*Discard) Set

func (o *Discard) Set(v interface{}) error

type Fragment

type Fragment struct {
	// contains filtered or unexported fields
}

func (Fragment) Get

func (o Fragment) Get() string

func (Fragment) IsSet

func (o Fragment) IsSet() bool

func (*Fragment) Reset

func (o *Fragment) Reset()

func (*Fragment) Set

func (o *Fragment) Set(v interface{}) error

func (Fragment) String

func (o Fragment) String() string

type Host

type Host struct {
	// contains filtered or unexported fields
}

func (Host) Get

func (o Host) Get() interface{}

func (Host) IsSet

func (o Host) IsSet() bool

func (*Host) Set

func (o *Host) Set(v interface{}) error

func (Host) String

func (o Host) String() string

type Items

type Items struct {
	// contains filtered or unexported fields
}

func (*Items) Append

func (o *Items) Append(v []string)

func (Items) Count

func (o Items) Count() uint64

func (Items) Get

func (o Items) Get() interface{}

func (Items) GetValues

func (o Items) GetValues() []string

func (Items) IsSet

func (o Items) IsSet() bool

func (*Items) Reset

func (o *Items) Reset()

func (*Items) Set

func (o *Items) Set(v interface{}) error

func (*Items) SetValues

func (o *Items) SetValues(v []interface{}) error

func (Items) String

func (o Items) String(sep string) string

func (*Items) TrimN

func (o *Items) TrimN(n uint64)

type PC

type PC struct {
	// contains filtered or unexported fields
}

func NewPC

func NewPC(cri []byte) (*PC, error)

func (PC) AtEnd

func (o PC) AtEnd() bool

func (PC) Curr

func (o PC) Curr() (interface{}, bool)

func (PC) Empty

func (o PC) Empty() bool

func (*PC) Next

func (o *PC) Next() (interface{}, bool)

func (PC) Peek

func (o PC) Peek() (interface{}, bool)

func (*PC) Step

func (o *PC) Step() bool

type Path

type Path struct {
	Items
}

path = [*text]

func (*Path) Append

func (o *Path) Append(v []string)

func (Path) Get

func (o Path) Get() interface{}

func (Path) GetSegments

func (o Path) GetSegments() []string

func (Path) IsSet

func (o Path) IsSet() bool

func (Path) NumSegments

func (o Path) NumSegments() uint64

func (*Path) Reset

func (o *Path) Reset()

func (*Path) Set

func (o *Path) Set(v interface{}) error

func (*Path) TrimN

func (o *Path) TrimN(n uint64)

type Port

type Port struct {
	// contains filtered or unexported fields
}

func (Port) Get

func (o Port) Get() uint64

func (Port) IsSet

func (o Port) IsSet() bool

func (*Port) Set

func (o *Port) Set(v interface{}) error

func (Port) String

func (o Port) String() string

type Query

type Query struct {
	Items
}

query = [*text]

func (Query) Get

func (o Query) Get() interface{}

func (Query) IsSet

func (o Query) IsSet() bool

func (*Query) Reset

func (o *Query) Reset()

func (*Query) Set

func (o *Query) Set(v interface{}) error

func (Query) String

func (o Query) String() string

type Scheme

type Scheme struct {
	// contains filtered or unexported fields
}

func (Scheme) Get

func (o Scheme) Get() interface{}

func (Scheme) IsSet

func (o Scheme) IsSet() bool

func (*Scheme) Set

func (o *Scheme) Set(v interface{}) error

func (Scheme) String

func (o Scheme) String() string

type TestVector

type TestVector struct {
	URI         string `json:"uri"`
	CRI         string `json:"cri"`
	URIFromCRI  string `json:"uri-from-cri"`
	ResolvedCRI string `json:"resolved-cri"`
	ResolvedURI string `json:"resolved-uri"`
}

type Tests

type Tests struct {
	BaseURI     string       `json:"base-uri"`
	BaseCRI     string       `json:"base-cri"`
	TestVectors []TestVector `json:"test-vectors"`
}

func LoadTests

func LoadTests(testsJSONFile string) (Tests, error)

Jump to

Keyboard shortcuts

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