routing

package
Version: v0.0.0-...-7271f6c Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2015 License: MIT Imports: 1 Imported by: 2

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location string

func (Location) Lookup

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

func (Location) LookupAlias

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

func (Location) Register

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

type LookupType

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

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

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.

Jump to

Keyboard shortcuts

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