proxy.go 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. // Package proxy contains all proxies used by V2Ray.
  2. package proxy
  3. import (
  4. "context"
  5. "v2ray.com/core/app/dispatcher"
  6. "v2ray.com/core/common/net"
  7. "v2ray.com/core/transport/internet"
  8. "v2ray.com/core/transport/ray"
  9. )
  10. // An Inbound processes inbound connections.
  11. type Inbound interface {
  12. // Network returns a list of network that this inbound supports. Connections with not-supported networks will not be passed into Process().
  13. Network() net.NetworkList
  14. // Process processes a connection of given network. If necessary, the Inbound can dispatch the connection to an Outbound.
  15. Process(context.Context, net.Network, internet.Connection, dispatcher.Interface) error
  16. }
  17. // An Outbound process outbound connections.
  18. type Outbound interface {
  19. // Process processes the given connection. The given dialer may be used to dial a system outbound connection.
  20. Process(context.Context, ray.OutboundRay, Dialer) error
  21. }
  22. // Dialer is used by OutboundHandler for creating outbound connections.
  23. type Dialer interface {
  24. // Dial dials a system connection to the given destination.
  25. Dial(ctx context.Context, destination net.Destination) (internet.Connection, error)
  26. }