identity

package
v0.0.0-...-30b4a77 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2016 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package identity contains helper functions for Mute identities.

Index

Constants

View Source
const Alphabet = "abcdefghijklmnopqrstuvwxyz0123456789-."

Alphabet defines the alphabet for the localpart of Mute identities.

View Source
const MaxLen = 254

MaxLen defines the maximum length of a Mute identity (localpart@domain). The restriction is the same as with email addresses.

Variables

View Source
var ErrNotMapped = errors.New("identity: identity is not well-formed or not mapped")

ErrNotMapped is returned if an identity is not well-formed or not mapped.

View Source
var ErrTooLong = fmt.Errorf("identity: maximum total length is %d", MaxLen)

ErrTooLong is returned if an identity is too long (larger than MaxLen).

Functions

func IsMapped

func IsMapped(identity string) error

IsMapped returns an error, if the given identity is not well-formed or not mapped.

func Map

func Map(identity string) (string, error)

Map maps the given identity to the allowed character set and reports unrecoverable errors.

func MapDomain

func MapDomain(domain string) string

MapDomain maps the given domain to lower case.

func MapLocalpart

func MapLocalpart(localpart string) (string, error)

MapLocalpart maps the given localpart to the allowed character set and reports unrecoverable errors.

func MapPlus

func MapPlus(identity string) (mappedID, mappedDomain string, err error)

MapPlus maps the given identity to the allowed character set and reports unrecoverable errors (like Map). Additionally, it also returns the mapped domain for further use.

func Split

func Split(identity string) (localpart, domain string, err error)

Split splits the given identity into localpart and domain.

Types

This section is empty.

Jump to

Keyboard shortcuts

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