2018-10-11 14:43:37 -04:00
|
|
|
package routing
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-01-02 10:16:23 -05:00
|
|
|
"github.com/v2fly/v2ray-core/v5/common/net"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/features"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/transport"
|
2018-10-11 14:43:37 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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.
|
2018-12-03 16:44:42 -05:00
|
|
|
//
|
|
|
|
// v2ray:api:stable
|
2018-10-11 14:43:37 -04:00
|
|
|
type Dispatcher interface {
|
|
|
|
features.Feature
|
|
|
|
|
|
|
|
// Dispatch returns a Ray for transporting data for the given request.
|
2018-11-03 07:36:29 -04:00
|
|
|
Dispatch(ctx context.Context, dest net.Destination) (*transport.Link, error)
|
2018-10-11 14:43:37 -04:00
|
|
|
}
|
2018-10-12 17:57:56 -04:00
|
|
|
|
2018-10-13 09:15:49 -04:00
|
|
|
// DispatcherType returns the type of Dispatcher interface. Can be used to implement common.HasType.
|
2018-12-03 16:44:42 -05:00
|
|
|
//
|
|
|
|
// v2ray:api:stable
|
2018-10-12 17:57:56 -04:00
|
|
|
func DispatcherType() interface{} {
|
|
|
|
return (*Dispatcher)(nil)
|
|
|
|
}
|