mirror of https://github.com/XTLS/Xray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
844 B
28 lines
844 B
package routing |
|
|
|
import ( |
|
"context" |
|
|
|
"github.com/xtls/xray-core/common/net" |
|
"github.com/xtls/xray-core/features" |
|
"github.com/xtls/xray-core/transport" |
|
) |
|
|
|
// Dispatcher is a feature that dispatches inbound requests to outbound handlers based on rules. |
|
// Dispatcher is required to be registered in a Xray instance to make Xray function properly. |
|
// |
|
// xray:api:stable |
|
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) |
|
DispatchLink(ctx context.Context, dest net.Destination, link *transport.Link) error |
|
} |
|
|
|
// DispatcherType returns the type of Dispatcher interface. Can be used to implement common.HasType. |
|
// |
|
// xray:api:stable |
|
func DispatcherType() interface{} { |
|
return (*Dispatcher)(nil) |
|
}
|
|
|