navigator

package
v1.6.9 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NavigatorMeasurementTTLDefault    = 4 * time.Hour
	NavigatorMeasurementTTLByCostBase = 6 * time.Minute
	NavigatorMeasurementTTLByCostMin  = 4 * time.Hour
	NavigatorMeasurementTTLByCostMax  = 50 * time.Hour
)

Measurements Configuration.

View Source
const (
	OptimizePurposeBootstrap       = "bootstrap"
	OptimizePurposeDesegregate     = "desegregate"
	OptimizePurposeWait            = "wait"
	OptimizePurposeTargetStructure = "target-structure"
)

Optimization Purposes.

View Source
const (
	RoutingProfileHomeID      = "home"
	RoutingProfileSingleHopID = "single-hop"
	RoutingProfileDoubleHopID = "double-hop"
	RoutingProfileTripleHopID = "triple-hop"
)

Routing Profile Names.

Variables

View Source
var (
	// ErrHomeHubUnset is returned when the Home Hub is required and not set.
	ErrHomeHubUnset = errors.New("map has no Home Hub set")

	// ErrEmptyMap is returned when the Map is empty.
	ErrEmptyMap = errors.New("map is empty")

	// ErrHubNotFound is returned when the Hub was not found on the Map.
	ErrHubNotFound = errors.New("hub not found")

	// ErrAllPinsDisregarded is returned when all pins have been disregarded.
	ErrAllPinsDisregarded = errors.New("all pins have been disregarded")
)
View Source
var (
	DefaultRoutingProfileID = profile.DefaultRoutingProfileID

	RoutingProfileHome = &RoutingProfile{
		ID:      "home",
		Name:    "Plain VPN Mode",
		MinHops: 1,
		MaxHops: 1,
	}
	RoutingProfileSingleHop = &RoutingProfile{
		ID:           "single-hop",
		Name:         "Speed Focused",
		MinHops:      1,
		MaxHops:      3,
		MaxExtraHops: 1,
		MaxExtraCost: 10000,
	}
	RoutingProfileDoubleHop = &RoutingProfile{
		ID:           "double-hop",
		Name:         "Balanced",
		MinHops:      2,
		MaxHops:      4,
		MaxExtraHops: 2,
		MaxExtraCost: 10000,
	}
	RoutingProfileTripleHop = &RoutingProfile{
		ID:           "triple-hop",
		Name:         "Privacy Focused",
		MinHops:      3,
		MaxHops:      5,
		MaxExtraHops: 3,
		MaxExtraCost: 10000,
	}
)

Routing Profiles.

View Source
var DeriveTunnelOptions func(lp *profile.LayeredProfile, destination *intel.Entity, connEncrypted bool) *Options

DeriveTunnelOptions derives and returns the tunnel options from the connection and profile. This function lives in firewall/tunnel.go and is set here to avoid import loops.

Functions

func CalculateDestinationCost

func CalculateDestinationCost(proximity float32) (cost float32)

CalculateDestinationCost calculates the cost of a destination hub to a destination server based on the given proximity. Ranges from 0 to 2500.

func CalculateHubCost

func CalculateHubCost(load int) (cost float32)

CalculateHubCost calculates the cost of using a Hub based on the given Hub load. Ranges from 100 to 10000.

func CalculateLaneCost

func CalculateLaneCost(latency time.Duration, capacity int) (cost float32)

CalculateLaneCost calculates the cost of using a Lane based on the given Lane latency and capacity. Ranges from 0 to 10000.

func HubPoliciesAreSet

func HubPoliciesAreSet(policies []endpoints.Endpoints) bool

HubPoliciesAreSet returns whether any of the given hub policies are set and non-empty.

Types

type AnalysisState

type AnalysisState struct {
	// Suggested signifies that a direct connection to this Hub is suggested by
	// the optimization algorithm.
	Suggested bool

	// SuggestedHopDistance holds the hop distance to this Hub when only
	// considering the suggested Hubs as connected.
	SuggestedHopDistance int

	// SuggestedHopDistanceInRegion holds the hop distance to this Hub in the
	// same region when only considering the suggested Hubs as connected.
	SuggestedHopDistanceInRegion int

	// CrossRegionalConnections holds the amount of connections a Pin has from
	// the current region.
	CrossRegionalConnections int
	// CrossRegionalLowestCostLane holds the lowest cost of the counted
	// connections from the current region.
	CrossRegionalLowestCostLane float32
	// CrossRegionalLaneCosts holds all the cross regional lane costs.
	CrossRegionalLaneCosts []float32
	// CrossRegionalHighestCostInHubLimit holds to highest cost of the lowest
	// cost connections within the maximum allowed lanes on a Hub from the
	// current region.
	CrossRegionalHighestCostInHubLimit float32
}

AnalysisState holds state for analyzing the network for optimizations.

type DestinationHubOptions

type DestinationHubOptions HubOptions

DestinationHubOptions holds configuration options for Destination Hub operations with the Map.

func (*DestinationHubOptions) Matcher

func (o *DestinationHubOptions) Matcher(hubIntel *hub.Intel) PinMatcher

Matcher generates a PinMatcher based on the Options.

type HomeHubOptions

type HomeHubOptions HubOptions

HomeHubOptions holds configuration options for Home Hub operations with the Map.

func (*HomeHubOptions) Matcher

func (o *HomeHubOptions) Matcher(hubIntel *hub.Intel) PinMatcher

Matcher generates a PinMatcher based on the Options.

type Hop

type Hop struct {

	// HubID is the Hub ID.
	HubID string

	// Cost is the cost for both Lane to this Hub and the Hub itself.
	Cost float32
	// contains filtered or unexported fields
}

Hop is one hop of a route's path.

func (*Hop) Pin

func (hop *Hop) Pin() *Pin

Pin returns the Pin of the Hop.

type HubOptions

type HubOptions struct {
	// Regard holds required States. Only Hubs where all of these are present
	// will taken into account for the operation. If NoDefaults is not set, a
	// basic set of desirable states is added automatically.
	Regard PinState

	// Disregard holds disqualifying States. Only Hubs where none of these are
	// present will be taken into account for the operation. If NoDefaults is not
	// set, a basic set of undesirable states is added automatically.
	Disregard PinState

	// NoDefaults declares whether default and recommended Regard and Disregard states should not be used.
	NoDefaults bool

	// HubPolicies is a collection of endpoint lists that Hubs must pass in order
	// to be taken into account for the operation.
	HubPolicies []endpoints.Endpoints

	// RequireVerifiedOwners specifies which verified owners are allowed to be used.
	// If the list is empty, all owners are allowed.
	RequireVerifiedOwners []string

	// CheckHubPolicyWith provides an entity that must match the Hubs entry or exit
	// policy (depending on type) in order to be taken into account for the operation.
	CheckHubPolicyWith *intel.Entity
}

HubOptions holds configuration options for a specific hub type for operations with the Map.

func (HubOptions) Copy

func (o HubOptions) Copy() HubOptions

Copy returns a shallow copy of the Options.

func (*HubOptions) Matcher

func (o *HubOptions) Matcher(hubType HubType, hubIntel *hub.Intel) PinMatcher

Matcher generates a PinMatcher based on the Options.

type HubType

type HubType uint8

HubType is the usage type of a Hub in routing.

const (
	HomeHub HubType = iota
	TransitHub
	DestinationHub
)

Hub Types.

type Lane

type Lane struct {
	// Pin is the Pin/Hub this Lane connects to.
	Pin *Pin

	// Capacity designates the available bandwidth between these Hubs.
	// It is specified in bit/s.
	Capacity int

	// Lateny designates the latency between these Hubs.
	// It is specified in nanoseconds.
	Latency time.Duration

	// Cost is the routing cost of this lane.
	Cost float32
	// contains filtered or unexported fields
}

Lane is a connection to another Hub.

type LaneExport

type LaneExport struct {
	HubID string

	// Capacity designates the available bandwidth between these Hubs.
	// It is specified in bit/s.
	Capacity int

	// Lateny designates the latency between these Hubs.
	// It is specified in nanoseconds.
	Latency time.Duration
}

LaneExport is the exportable version of a Lane.

type Map

type Map struct {
	sync.RWMutex
	Name string
	// contains filtered or unexported fields
}

Map represent a collection of Pins and their relationship and status.

var (

	// Main is the primary map used.
	Main *Map
)

func NewMap

func NewMap(name string, enableMeasuring bool) *Map

NewMap returns a new and empty Map.

func (*Map) AddBootstrapHubs

func (m *Map) AddBootstrapHubs(bootstrapTransports []string) error

AddBootstrapHubs adds the given bootstrap hubs to the map.

func (*Map) CancelHubUpdateHook

func (m *Map) CancelHubUpdateHook()

CancelHubUpdateHook cancels the map's update hook.

func (*Map) Close

func (m *Map) Close()

Close removes the map's integration, taking it "offline".

func (*Map) DefaultOptions

func (m *Map) DefaultOptions() *Options

DefaultOptions returns the default options for this Map.

func (*Map) FindNearestHubs

func (m *Map) FindNearestHubs(locationV4, locationV6 *geoip.Location, opts *Options, matchFor HubType) ([]*hub.Hub, error)

FindNearestHubs searches for the nearest Hubs to the given IP address. The returned Hubs must not be modified in any way.

func (*Map) FindRouteToHub

func (m *Map) FindRouteToHub(hubID string, opts *Options) (*Routes, error)

FindRouteToHub finds possible routes to the given Hub, with the given options.

func (*Map) FindRoutes

func (m *Map) FindRoutes(ip net.IP, opts *Options) (*Routes, error)

FindRoutes finds possible routes to the given IP, with the given options.

func (*Map) GetAvailableCountries

func (m *Map) GetAvailableCountries(opts *Options, forType HubType) map[string]*geoip.CountryInfo

GetAvailableCountries returns a map of countries including their information where the map has pins suitable for the given type.

func (*Map) GetHome

func (m *Map) GetHome() (*Pin, *docks.CraneTerminal)

GetHome returns the current home and it's accompanying terminal. Both may be nil.

func (*Map) GetIntel

func (m *Map) GetIntel() *hub.Intel

GetIntel returns the map's intel data.

func (*Map) GetPin

func (m *Map) GetPin(hubID string) (pin *Pin, ok bool)

GetPin returns the Pin of the Hub with the given ID.

func (*Map) InitializeFromDatabase

func (m *Map) InitializeFromDatabase() error

InitializeFromDatabase loads all Hubs from the given database prefix and adds them to the Map.

func (*Map) Optimize

func (m *Map) Optimize(opts *HubOptions) (result *OptimizationResult, err error)

Optimize analyzes the map and suggests changes.

func (*Map) PushPinChanges

func (m *Map) PushPinChanges()

PushPinChanges pushes all changed pins to subscribers.

func (*Map) RegisterHubUpdateHook

func (m *Map) RegisterHubUpdateHook() (err error)

RegisterHubUpdateHook registers a database pre-put hook that updates all Hubs saved at the given database prefix.

func (*Map) RemoveHub

func (m *Map) RemoveHub(id string)

RemoveHub removes a Hub from the Map.

func (*Map) ResetFailingStates

func (m *Map) ResetFailingStates(ctx context.Context)

ResetFailingStates resets the failing state on all pins.

func (*Map) SaveMeasuredHubs

func (m *Map) SaveMeasuredHubs()

SaveMeasuredHubs saves all Hubs that have unsaved measurements.

func (*Map) SetHome

func (m *Map) SetHome(id string, t *docks.CraneTerminal) (ok bool)

SetHome sets the given hub as the new home. Optionally, a terminal may be supplied to accompany the home hub.

func (*Map) Stats

func (m *Map) Stats() *MapStats

Stats collects and returns statistics from the map.

func (*Map) UpdateConfigQuickSettings

func (m *Map) UpdateConfigQuickSettings(ctx context.Context) error

UpdateConfigQuickSettings updates config quick settings with available countries.

func (*Map) UpdateHub

func (m *Map) UpdateHub(h *hub.Hub)

UpdateHub updates a Hub on the Map.

func (*Map) UpdateIntel

func (m *Map) UpdateIntel(update *hub.Intel, trustNodes []string) error

UpdateIntel supplies the map with new intel data. The data is not copied, so it must not be modified after being supplied. If the map is empty, the bootstrap hubs will be added to the map.

type MapStats

type MapStats struct {
	Name            string
	States          map[PinState]int
	Lanes           map[int]int
	ActiveTerminals int
}

MapStats holds generic map statistics.

func (*MapStats) String

func (ms *MapStats) String() string

type OptimizationResult

type OptimizationResult struct {
	// Purpose holds a semi-human readable constant of the optimization purpose.
	Purpose string

	// Approach holds human readable descriptions of how the stated purpose
	// should be achieved.
	Approach []string

	// SuggestedConnections holds the Hubs to which connections are suggested.
	SuggestedConnections []*SuggestedConnection

	// MaxConnect specifies how many connections should be created at maximum
	// based on this optimization.
	MaxConnect int

	// StopOthers specifies if other connections than the suggested ones may
	// be stopped.
	StopOthers bool
	// contains filtered or unexported fields
}

OptimizationResult holds the result of an optimizaion analysis.

type Options

type Options struct {
	// Home holds the options for Home Hubs.
	Home *HomeHubOptions

	// Transit holds the options for Transit Hubs.
	Transit *TransitHubOptions

	// Destination holds the options for Destination Hubs.
	Destination *DestinationHubOptions

	// RoutingProfile defines the algorithm to use to find a route.
	RoutingProfile string
}

Options holds configuration options for operations with the Map.

func (*Options) Copy

func (o *Options) Copy() *Options

Copy returns a shallow copy of the Options.

func (*Options) Matcher

func (o *Options) Matcher(hubType HubType, hubIntel *hub.Intel) PinMatcher

Matcher generates a PinMatcher based on the Options. Always use the Matcher on option structs if you can.

type Pin

type Pin struct {
	// Hub Information
	Hub        *hub.Hub
	EntityV4   *intel.Entity
	EntityV6   *intel.Entity
	LocationV4 *geoip.Location
	LocationV6 *geoip.Location

	// Hub Status
	State PinState
	// VerifiedOwner holds the name of the verified owner / operator of the Hub.
	VerifiedOwner string
	// HopDistance signifies the needed hops to reach this Hub.
	// HopDistance is measured from the view of a client.
	// A Hub itself will have itself at distance 1.
	// Directly connected Hubs have a distance of 2.
	HopDistance int
	// Cost is the routing cost of this Hub.
	Cost float32
	// ConnectedTo holds validated lanes.
	ConnectedTo map[string]*Lane // Key is Hub ID.

	// FailingUntil specifies until when this Hub should be regarded as failing.
	// This is connected to StateFailing.
	FailingUntil time.Time

	// Connection holds a information about a connection to the Hub of this Pin.
	Connection *PinConnection
	// contains filtered or unexported fields
}

Pin represents a Hub on a Map.

func (*Pin) Export

func (pin *Pin) Export() *PinExport

Export puts the Pin's information into an exportable format.

func (*Pin) GetActiveTerminal

func (pin *Pin) GetActiveTerminal() *docks.ExpansionTerminal

GetActiveTerminal returns the active terminal of the pin.

func (*Pin) GetLocation

func (pin *Pin) GetLocation(ip net.IP) *geoip.Location

GetLocation returns the geoip location of the Pin, preferring first the given IP, then IPv4.

func (*Pin) GetState

func (pin *Pin) GetState() PinState

GetState returns the state of the pin.

func (*Pin) HasActiveTerminal

func (pin *Pin) HasActiveTerminal() bool

HasActiveTerminal returns whether the Pin has an active terminal.

func (*Pin) IsFailing

func (pin *Pin) IsFailing() bool

IsFailing returns whether the pin should be treated as failing. The Pin is locked for this.

func (*Pin) Lock

func (pin *Pin) Lock()

Lock locks the Pin via the Hub's lock.

func (*Pin) MarkAsFailingFor

func (pin *Pin) MarkAsFailingFor(duration time.Duration)

MarkAsFailingFor marks the pin as failing. The Pin is locked for this. Changes are pushed.

func (*Pin) NotifyTerminalChange

func (pin *Pin) NotifyTerminalChange()

NotifyTerminalChange notifies subscribers of the changed terminal.

func (*Pin) ResetFailingState

func (pin *Pin) ResetFailingState()

ResetFailingState resets the failing state. The Pin is locked for this. Changes are not pushed, but Pins are marked.

func (*Pin) SetActiveTerminal

func (pin *Pin) SetActiveTerminal(pc *PinConnection)

SetActiveTerminal sets an active terminal for the pin.

func (*Pin) String

func (pin *Pin) String() string

String returns a human-readable representation of the Pin.

func (*Pin) Unlock

func (pin *Pin) Unlock()

Unlock unlocks the Pin via the Hub's lock.

type PinConnection

type PinConnection struct {
	// Terminal holds the active terminal session.
	Terminal *docks.ExpansionTerminal

	// Route is the route built for this terminal.
	Route *Route
}

PinConnection represents a connection to a terminal on the Hub.

type PinExport

type PinExport struct {
	record.Base
	sync.Mutex

	ID        string
	Name      string
	Map       string
	FirstSeen time.Time

	EntityV4 *intel.Entity
	EntityV6 *intel.Entity

	States        []string // From pin.State
	VerifiedOwner string
	HopDistance   int

	ConnectedTo   map[string]*LaneExport // Key is Hub ID.
	Route         []string               // Includes Home Hub and this Pin's ID.
	SessionActive bool

	Info   *hub.Announcement
	Status *hub.Status
}

PinExport is the exportable version of a Pin.

type PinMatcher

type PinMatcher func(pin *Pin) bool

PinMatcher is a stateful matching function generated by Options.

type PinState

type PinState uint16

PinState holds a bit-mapped collection of Pin states, or a single state used for assigment and matching.

const (
	// StateNone represents an empty state.
	StateNone PinState = 0

	// StateInvalid signifies that there was an error while processing or
	// handling this Hub.
	StateInvalid PinState = 1 << (iota - 1) // 1 << 0 => 00000001 => 0x01

	// StateSuperseded signifies that this Hub was superseded by another. This is
	// the case if any other Hub with a matching IP was verified after this one.
	// Verification timestamp equals Hub.FirstSeen.
	StateSuperseded // 0x02

	// StateFailing signifies that a recent error was encountered while
	// communicating with this Hub. Pin.FailingUntil specifies when this state is
	// re-evaluated at earliest.
	StateFailing // 0x04

	// StateOffline signifies that the Hub is offline.
	StateOffline // 0x08

	// StateHasRequiredInfo signifies that the Hub announces the minimum required
	// information about itself.
	StateHasRequiredInfo // 0x10

	// StateReachable signifies that the Hub is reachable via the network from
	// the currently connected primary Hub.
	StateReachable // 0x20

	// StateActive signifies that everything seems fine with the Hub and
	// connections to it should succeed. This is tested by checking if a valid
	// semi-ephemeral public key is available.
	StateActive // 0x40

	// StateTrusted signifies the Hub has the special trusted status.
	StateTrusted // 0x0100

	// StateUsageDiscouraged signifies that usage of the Hub is discouraged for any task.
	StateUsageDiscouraged // 0x0200

	// StateUsageAsHomeDiscouraged signifies that usage of the Hub as a Home Hub is discouraged.
	StateUsageAsHomeDiscouraged // 0x0400

	// StateUsageAsDestinationDiscouraged signifies that usage of the Hub as a Destination Hub is discouraged.
	StateUsageAsDestinationDiscouraged // 0x0800

	// StateIsHomeHub signifies that the Hub is the current Home Hub. While not
	// negative in itself, selecting the Home Hub does not make sense in almost
	// all cases.
	StateIsHomeHub // 0x1000

	// StateConnectivityIssues signifies that the Hub reports connectivity issues.
	// This might impact all connectivity or just some.
	// This does not invalidate the Hub for all operations and not in all cases.
	StateConnectivityIssues // 0x2000

	// StateAllowUnencrypted signifies that the Hub is available to handle unencrypted connections.
	StateAllowUnencrypted // 0x4000

	// StateSummaryRegard summarizes all states that must always be set in order to take a Hub into consideration for any task.
	// TODO: Add StateHasRequiredInfo when we start enforcing Hub information.
	StateSummaryRegard = StateReachable | StateActive

	// StateSummaryDisregard summarizes all states that must not be set in order to take a Hub into consideration for any task.
	StateSummaryDisregard = StateInvalid |
		StateSuperseded |
		StateFailing |
		StateOffline |
		StateUsageDiscouraged |
		StateIsHomeHub
)

func (PinState) Add

func (pinState PinState) Add(states PinState) PinState

Add returns a new PinState with the given states added.

func (PinState) Export

func (pinState PinState) Export() []string

Export returns a list of all state names.

func (PinState) Has

func (pinState PinState) Has(states PinState) bool

Has returns whether the state has all of the given states.

func (PinState) HasAnyOf

func (pinState PinState) HasAnyOf(states PinState) bool

HasAnyOf returns whether the state has any of the given states.

func (PinState) HasNoneOf

func (pinState PinState) HasNoneOf(states PinState) bool

HasNoneOf returns whether the state does not have any of the given states.

func (PinState) Name

func (pinState PinState) Name() string

Name returns the name of a single state flag.

func (PinState) Remove

func (pinState PinState) Remove(states PinState) PinState

Remove returns a new PinState with the given states removed.

func (PinState) String

func (pinState PinState) String() string

String returns the states as a human readable string.

type Region

type Region struct {
	ID   string
	Name string
	// contains filtered or unexported fields
}

Region specifies a group of Hubs for optimization purposes.

type Route

type Route struct {
	// Path is a list of Transit Hubs and the Destination Hub, including the Cost
	// for each Hop.
	Path []*Hop

	// DstCost is the calculated cost between the Destination Hub and the destination IP.
	DstCost float32

	// TotalCost is the sum of all costs of this Route.
	TotalCost float32

	// Algorithm is the ID of the algorithm used to calculate the route.
	Algorithm string
}

Route is a path through the map.

func (*Route) CopyUpTo

func (r *Route) CopyUpTo(n int) *Route

CopyUpTo makes a somewhat deep copy of the Route up to the specified amount and returns it. Hops themselves are not copied, because their data does not change. Therefore, returned Hops may not be edited. Specify an amount of 0 to copy all.

func (*Route) String

func (r *Route) String() string

type Routes

type Routes struct {
	All []*Route
	// contains filtered or unexported fields
}

Routes holds a collection of Routes.

func (*Routes) Len

func (r *Routes) Len() int

Len is the number of elements in the collection.

func (*Routes) Less

func (r *Routes) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (*Routes) Swap

func (r *Routes) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type RoutingProfile

type RoutingProfile struct {
	ID string

	// Name is the human readable name of the profile.
	Name string

	// MinHops defines how many hops a route must have at minimum. In order to
	// reduce confusion, the Home Hub is also counted.
	MinHops int

	// MaxHops defines the limit on how many hops a route may have. In order to
	// reduce confusion, the Home Hub is also counted.
	MaxHops int

	// MaxExtraHops sets a limit on how many extra hops are allowed in addition
	// to the amount of Hops in the currently best route. This is an optimization
	// option and should not interfere with finding the best route, but might
	// reduce the amount of routes found.
	MaxExtraHops int

	// MaxExtraCost sets a limit on the extra cost allowed in addition to the
	// cost of the currently best route. This is an optimization option and
	// should not interfere with finding the best route, but might reduce the
	// amount of routes found.
	MaxExtraCost float32
}

RoutingProfile defines a routing algorithm with some options.

func GetRoutingProfile

func GetRoutingProfile(id string) *RoutingProfile

GetRoutingProfile returns the routing profile with the given ID.

type StorageInterface

type StorageInterface struct {
	storage.InjectBase
}

StorageInterface provices a storage.Interface to the configuration manager.

func (*StorageInterface) Get

func (s *StorageInterface) Get(key string) (record.Record, error)

Get returns a database record.

func (*StorageInterface) Query

func (s *StorageInterface) Query(q *query.Query, local, internal bool) (*iterator.Iterator, error)

Query returns a an iterator for the supplied query.

type SuggestedConnection

type SuggestedConnection struct {
	// Hub holds the Hub to which a connection is suggested.
	Hub *hub.Hub

	// Reason holds a reason why this connection is suggested.
	Reason string
	// Duplicate marks duplicate entries. These should be ignored when
	// connecting, but are helpful for understand the optimization result.
	Duplicate bool
	// contains filtered or unexported fields
}

SuggestedConnection holds suggestions by the optimization system.

type TransitHubOptions

type TransitHubOptions HubOptions

TransitHubOptions holds configuration options for Transit Hub operations with the Map.

func (*TransitHubOptions) Matcher

func (o *TransitHubOptions) Matcher(hubIntel *hub.Intel) PinMatcher

Matcher generates a PinMatcher based on the Options.

type UpdateHook

type UpdateHook struct {
	database.HookBase
	// contains filtered or unexported fields
}

UpdateHook updates the a map from database changes.

func (*UpdateHook) PrePut

func (hook *UpdateHook) PrePut(r record.Record) (record.Record, error)

PrePut implements the Hook interface.

func (*UpdateHook) UsesPrePut

func (hook *UpdateHook) UsesPrePut() bool

UsesPrePut implements the Hook interface.

Jump to

Keyboard shortcuts

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