github.com/Uhtred009/v2ray-core-1@v4.31.2+incompatible/features/routing/dispatcher.go (about)

     1  package routing
     2  
     3  import (
     4  	"context"
     5  
     6  	"v2ray.com/core/common/net"
     7  	"v2ray.com/core/features"
     8  	"v2ray.com/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 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  }