valid

package
v0.0.0-...-8fa1bb7 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2019 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package valid does validation of various data types. For the most part, its functions are used by servers and enforce stronger constraints than client code needs to follow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirBlock

func DirBlock(block upspin.DirBlock) error

DirBlock verifies that the block is valid, that is, that it has a greater-than-zero Size, non-negative Offset, and valid Location.

func DirEntry

func DirEntry(entry *upspin.DirEntry) error

DirEntry verifies that the DirEntry is valid. It is intended for use by DirServer.Put, and so constrains the entry more rigorously than, for instance, the DirEntries that may be returned from servers. For example, it requires that a directory has no blocks, but a DirEntry for a directory returned by a server may contain block data. Rules: - present and valid Name and SignedName - Name is equal to SignedName - blocks may be present only if Attr == AttrNone - Link may be present only if Attr == AttrLink - Attr must not include AttrIncomplete - Packing must be known - Sequence must have a known special value or be non-negative - for non-directory entries, a Writer field is required.

func Endpoint

func Endpoint(endpoint upspin.Endpoint) error

Endpoint verifies that the endpoint looks syntactically valid. It does not check that the endpoint defines a reachable server.

func Reference

func Reference(ref upspin.Reference) error

Reference verifies that the Reference is valid. A Reference must be a non-empty UTF-8-encoded string of printable characters, as defined by Unicode. Also, although printable, the replacement rune (U+FFFD) is considered invalid, even if it is explicitly present, as it usually indicates erroneous UTF-8 or Unicode.

func User

func User(user *upspin.User) error

User verifies that the User struct is valid, that is, that all its fields are syntactically valid.

func UserName

func UserName(userName upspin.UserName) error

UserName verifies that the name is a syntactically valid user's email address. It also requires that the domain name be lower-cased to avoid ambiguity.

Types

This section is empty.

Jump to

Keyboard shortcuts

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