dispatcher.go 578 B

12345678910111213141516171819202122
  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. func DispatcherType() interface{} {
  16. return (*Dispatcher)(nil)
  17. }