proxy.go 802 B

123456789101112131415161718192021222324
  1. // Package proxy contains all proxies used by V2Ray.
  2. package proxy // import "github.com/v2ray/v2ray-core/proxy"
  3. import (
  4. v2net "github.com/v2ray/v2ray-core/common/net"
  5. "github.com/v2ray/v2ray-core/transport/ray"
  6. )
  7. // An InboundHandler handles inbound network connections to V2Ray.
  8. type InboundHandler interface {
  9. // Listen starts a InboundHandler by listen on a specific port.
  10. Listen(port v2net.Port) error
  11. // Close stops the handler to accepting anymore inbound connections.
  12. Close()
  13. // Port returns the port that the handler is listening on.
  14. Port() v2net.Port
  15. }
  16. // An OutboundHandler handles outbound network connection for V2Ray.
  17. type OutboundHandler interface {
  18. // Dispatch sends one or more Packets to its destination.
  19. Dispatch(firstPacket v2net.Packet, ray ray.OutboundRay) error
  20. }