forked from XTLS/Xray-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dispatcher.go
28 lines (23 loc) · 856 Bytes
/
dispatcher.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package routing
import (
"context"
"github.com/4nd3r5on/Xray-core/common/net"
"github.com/4nd3r5on/Xray-core/features"
"github.com/4nd3r5on/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)
}