Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package testlib
  2. import (
  3. "net"
  4. "time"
  5. "github.com/stretchr/testify/mock"
  6. )
  7. type EssentialsConnMock struct {
  8. mock.Mock
  9. }
  10. func (n *EssentialsConnMock) Read(b []byte) (int, error) {
  11. args := n.Called(b)
  12. return args.Int(0), args.Error(1)
  13. }
  14. func (n *EssentialsConnMock) Write(b []byte) (int, error) {
  15. args := n.Called(b)
  16. return args.Int(0), args.Error(1)
  17. }
  18. func (n *EssentialsConnMock) Close() error {
  19. return n.Called().Error(0) //nolint: wrapcheck
  20. }
  21. func (n *EssentialsConnMock) CloseRead() error {
  22. return n.Called().Error(0) //nolint: wrapcheck
  23. }
  24. func (n *EssentialsConnMock) CloseWrite() error {
  25. return n.Called().Error(0) //nolint: wrapcheck
  26. }
  27. func (n *EssentialsConnMock) LocalAddr() net.Addr {
  28. return n.Called().Get(0).(net.Addr) //nolint: forcetypeassert
  29. }
  30. func (n *EssentialsConnMock) RemoteAddr() net.Addr {
  31. return n.Called().Get(0).(net.Addr) //nolint: forcetypeassert
  32. }
  33. func (n *EssentialsConnMock) SetDeadline(t time.Time) error {
  34. return n.Called(t).Error(0) //nolint: wrapcheck
  35. }
  36. func (n *EssentialsConnMock) SetReadDeadline(t time.Time) error {
  37. return n.Called(t).Error(0) //nolint: wrapcheck
  38. }
  39. func (n *EssentialsConnMock) SetWriteDeadline(t time.Time) error {
  40. return n.Called(t).Error(0) //nolint: wrapcheck
  41. }