Documentation ¶
Index ¶
- Variables
- type URL
- func (u *URL) AccountID() []byte
- func (u *URL) AccountID32() [32]byte
- func (u *URL) Equal(v *URL) bool
- func (u *URL) Hostname() string
- func (u *URL) Identity() *URL
- func (u *URL) IdentityAccountID() []byte
- func (u *URL) IdentityAccountID32() [32]byte
- func (u *URL) JoinPath(s ...string) *URL
- func (u *URL) MarshalJSON() ([]byte, error)
- func (u *URL) Parent() (*URL, bool)
- func (u *URL) Password() string
- func (u *URL) Port() string
- func (u *URL) QueryValues() Values
- func (u *URL) RawString() string
- func (u *URL) RootIdentity() *URL
- func (u *URL) Routing() uint64
- func (u *URL) String() string
- func (u *URL) URL() *url.URL
- func (u *URL) UnmarshalJSON(data []byte) error
- func (u *URL) Username() string
- type Values
Constants ¶
This section is empty.
Variables ¶
var ErrMissingHost = errors.New("missing host")
ErrMissingHost means that a URL did not include a hostname.
var ErrWrongScheme = errors.New("wrong scheme")
ErrWrongScheme means that a URL included a scheme other than the Accumulate scheme.
Functions ¶
This section is empty.
Types ¶
type URL ¶
URL is an Accumulate URL.
func Parse ¶
Parse parses the string as an Accumulate URL. The scheme may be omitted, in which case `acc://` will be added, but if present it must be `acc`. The hostname must be non-empty. RawPath, ForceQuery, and RawFragment are not preserved.
func (*URL) AccountID ¶
AccountID constructs an account identifier from the lower case hostname and path. The port is not included. If the path does not begin with `/`, `/` is added between the hostname and the path.
ID = Hash(LowerCase(Sprintf("%s/%s", u.Host(), u.Path)))
func (*URL) AccountID32 ¶
AccountID32 returns AccountID as a [32]byte.
func (*URL) Equal ¶
Equal reports whether u and v, converted to strings and interpreted as UTF-8, are equal under Unicode case-folding.
func (*URL) IdentityAccountID ¶
IdentityAccountID constructs an account identifier from the lower case hostname. The port is not included.
ID = Hash(LowerCase(u.Host()))
func (*URL) IdentityAccountID32 ¶
IdentityAccountID32 returns IdentityAccountID as a [32]byte.
func (*URL) MarshalJSON ¶
MarshalJSON marshals the URL to JSON as a string.
func (*URL) Parent ¶ added in v0.5.1
Parent gets the URL's parent path, or returns the original URL and false.
func (*URL) QueryValues ¶
QueryValues parses Query and returns the corresponding values. It silently discards malformed value pairs. To check errors use net/url.ParseQuery.
func (*URL) RawString ¶
RawString concatenates all of the URL parts. Does not percent-encode anything. Primarily used for validation.
func (*URL) RootIdentity ¶ added in v0.5.1
RootIdentity returns a copy of the URL with an empty path.
func (*URL) Routing ¶
Routing returns the first 8 bytes of the identity account ID as an integer.
Routing = uint64(u.IdentityAccountID()[:8])
func (*URL) UnmarshalJSON ¶
UnmarshalJSON unmarshals the URL from JSON as a string.