github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/features/routing/dispatcher.go (about) 1 package routing 2 3 import ( 4 "context" 5 6 "github.com/v2fly/v2ray-core/v5/common/net" 7 "github.com/v2fly/v2ray-core/v5/features" 8 "github.com/v2fly/v2ray-core/v5/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 V2Ray instance to make V2Ray function properly. 13 // 14 // v2ray: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 // v2ray:api:stable 25 func DispatcherType() interface{} { 26 return (*Dispatcher)(nil) 27 }