github.com/EagleQL/Xray-core@v1.4.3/features/routing/dispatcher.go (about) 1 package routing 2 3 import ( 4 "context" 5 6 "github.com/xtls/xray-core/common/net" 7 "github.com/xtls/xray-core/features" 8 "github.com/xtls/xray-core/transport" 9 ) 10 11 // Dispatcher is a feature that dispatches inbound requests to outbound handlers based on rules. 12 // Dispatcher is required to be registered in a Xray instance to make Xray function properly. 13 // 14 // xray:api:stable 15 type Dispatcher interface { 16 features.Feature 17 18 // Dispatch returns a Ray for transporting data for the given request. 19 Dispatch(ctx context.Context, dest net.Destination) (*transport.Link, error) 20 } 21 22 // DispatcherType returns the type of Dispatcher interface. Can be used to implement common.HasType. 23 // 24 // xray:api:stable 25 func DispatcherType() interface{} { 26 return (*Dispatcher)(nil) 27 }