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.

events.go 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package mtglib
  2. import (
  3. "net"
  4. "time"
  5. )
  6. type EventStart struct {
  7. CreatedAt time.Time
  8. ConnID string
  9. RemoteIP net.IP
  10. }
  11. func (e EventStart) StreamID() string {
  12. return e.ConnID
  13. }
  14. func (e EventStart) Timestamp() time.Time {
  15. return e.CreatedAt
  16. }
  17. type EventConnectedToDC struct {
  18. CreatedAt time.Time
  19. ConnID string
  20. RemoteIP net.IP
  21. DC int
  22. }
  23. func (e EventConnectedToDC) StreamID() string {
  24. return e.ConnID
  25. }
  26. func (e EventConnectedToDC) Timestamp() time.Time {
  27. return e.CreatedAt
  28. }
  29. type EventTraffic struct {
  30. CreatedAt time.Time
  31. ConnID string
  32. Traffic uint
  33. IsRead bool
  34. }
  35. func (e EventTraffic) StreamID() string {
  36. return e.ConnID
  37. }
  38. func (e EventTraffic) Timestamp() time.Time {
  39. return e.CreatedAt
  40. }
  41. type EventFinish struct {
  42. CreatedAt time.Time
  43. ConnID string
  44. }
  45. func (e EventFinish) StreamID() string {
  46. return e.ConnID
  47. }
  48. func (e EventFinish) Timestamp() time.Time {
  49. return e.CreatedAt
  50. }
  51. type EventConcurrencyLimited struct {
  52. CreatedAt time.Time
  53. }
  54. func (e EventConcurrencyLimited) StreamID() string {
  55. return ""
  56. }
  57. func (e EventConcurrencyLimited) Timestamp() time.Time {
  58. return e.CreatedAt
  59. }
  60. type EventIPBlocklisted struct {
  61. CreatedAt time.Time
  62. RemoteIP net.IP
  63. }
  64. func (e EventIPBlocklisted) StreamID() string {
  65. return ""
  66. }
  67. func (e EventIPBlocklisted) Timestamp() time.Time {
  68. return e.CreatedAt
  69. }