connection.go 785 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package http
  2. import (
  3. "io"
  4. "time"
  5. "v2ray.com/core/common"
  6. "v2ray.com/core/common/net"
  7. )
  8. type Connection struct {
  9. Reader io.Reader
  10. Writer io.Writer
  11. Closer common.Closable
  12. Local net.Addr
  13. Remote net.Addr
  14. }
  15. func (c *Connection) Read(b []byte) (int, error) {
  16. return c.Reader.Read(b)
  17. }
  18. func (c *Connection) Write(b []byte) (int, error) {
  19. return c.Writer.Write(b)
  20. }
  21. func (c *Connection) Close() error {
  22. return c.Closer.Close()
  23. }
  24. func (c *Connection) LocalAddr() net.Addr {
  25. return c.Local
  26. }
  27. func (c *Connection) RemoteAddr() net.Addr {
  28. return c.Remote
  29. }
  30. func (c *Connection) SetDeadline(t time.Time) error {
  31. return nil
  32. }
  33. func (c *Connection) SetReadDeadline(t time.Time) error {
  34. return nil
  35. }
  36. func (c *Connection) SetWriteDeadline(t time.Time) error {
  37. return nil
  38. }