dispatcher.go 679 B

1234567891011121314151617181920212223
  1. package routing
  2. import (
  3. "context"
  4. "v2ray.com/core/common/net"
  5. "v2ray.com/core/common/vio"
  6. "v2ray.com/core/features"
  7. )
  8. // Dispatcher is a feature that dispatches inbound requests to outbound handlers based on rules.
  9. // Dispatcher is required to be registered in a V2Ray instance to make V2Ray function properly.
  10. type Dispatcher interface {
  11. features.Feature
  12. // Dispatch returns a Ray for transporting data for the given request.
  13. Dispatch(ctx context.Context, dest net.Destination) (*vio.Link, error)
  14. }
  15. // DispatcherType returns the type of Dispatcher interface. Can be used to implement common.HasType.
  16. func DispatcherType() interface{} {
  17. return (*Dispatcher)(nil)
  18. }