Index | Files

package routing

import ""

Package routing provides abstractions for routers on the AirDispatch network (translating addresses to server locations).


Package Files

location.go routing.go

type Location Uses

type Location string

func (Location) Lookup Uses

func (l Location) Lookup(addr string) (*identity.Address, error)

func (Location) LookupAlias Uses

func (l Location) LookupAlias(alias string) (*identity.Address, error)

func (Location) Register Uses

func (l Location) Register(*identity.Identity) error

type LookupType Uses

type LookupType string

LookupType wraps a string that determines which redirects are followed in the routing layer.

const (
    LookupTypeTX      LookupType = "TX"
    LookupTypeMAIL    LookupType = "MAIL"
    LookupTypeALERT   LookupType = "ALE"
    LookupTypeDEFAULT LookupType = "_"

Different constants for the lookup types.

type Redirect Uses

type Redirect struct {
    Type        LookupType
    Fingerprint string
    Alias       string

Redirect is a type of record on a Registration that alerts the client to send messages of a certain type to a different location.

type Router Uses

type Router interface {
    // Register function registers an identity with a router.
    Register(id *identity.Identity, alias string, redirects map[string]Redirect) error
    // Lookup function checks an address and returns an identity object.
    // Name is a type of lookup, either 'TX' for transfers, 'MAIL' for sending
    // mail 'ALE' for sending alerts, or '_' for default.
    Lookup(addr string, name LookupType) (*identity.Address, error)
    // Lookup function checks an alias and returns an identity object.
    LookupAlias(alias string, name LookupType) (*identity.Address, error)

The Router provides a way for AirDispatch applications to translate aliases and address fingerprints to identity objects.

Package routing imports 1 packages (graph) and is imported by 16 packages. Updated 2018-02-25. Refresh now. Tools for package owners.