routing

package
v4.7.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DispatcherType

func DispatcherType() interface{}

DispatcherType returns the type of Dispatcher interface. Can be used to implement common.HasType.

func RouterType

func RouterType() interface{}

RouterType return the type of Router interface. Can be used to implement common.HasType.

Types

type DefaultRouter

type DefaultRouter struct{}

DefaultRouter is an implementation of Router, which always returns ErrNoClue for routing decisions.

func (DefaultRouter) Close

func (DefaultRouter) Close() error

Close implements common.Closable.

func (DefaultRouter) PickRoute

func (DefaultRouter) PickRoute(ctx context.Context) (string, error)

PickRoute implements Router.

func (DefaultRouter) Start

func (DefaultRouter) Start() error

Start implements common.Runnable.

func (DefaultRouter) Type

func (DefaultRouter) Type() interface{}

Type implements common.HasType.

type Dispatcher

type Dispatcher interface {
	features.Feature

	// Dispatch returns a Ray for transporting data for the given request.
	Dispatch(ctx context.Context, dest net.Destination) (*transport.Link, error)
}

Dispatcher is a feature that dispatches inbound requests to outbound handlers based on rules. Dispatcher is required to be registered in a V2Ray instance to make V2Ray function properly.

type Router

type Router interface {
	features.Feature

	// PickRoute returns a tag of an OutboundHandler based on the given context.
	PickRoute(ctx context.Context) (string, error)
}

Router is a feature to choose an outbound tag for the given request.

Jump to

Keyboard shortcuts

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