1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-10 01:40:44 +00:00
v2fly/features/routing/dispatcher.go

24 lines
684 B
Go
Raw Normal View History

package routing
import (
"context"
"v2ray.com/core/common/net"
"v2ray.com/core/features"
2018-11-03 11:36:29 +00:00
"v2ray.com/core/transport"
)
// 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 Dispatcher interface {
features.Feature
// Dispatch returns a Ray for transporting data for the given request.
2018-11-03 11:36:29 +00:00
Dispatch(ctx context.Context, dest net.Destination) (*transport.Link, error)
}
2018-10-12 21:57:56 +00:00
2018-10-13 13:15:49 +00:00
// DispatcherType returns the type of Dispatcher interface. Can be used to implement common.HasType.
2018-10-12 21:57:56 +00:00
func DispatcherType() interface{} {
return (*Dispatcher)(nil)
}