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.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 EventDomainFronting struct {
  52. CreatedAt time.Time
  53. ConnID string
  54. }
  55. func (e EventDomainFronting) StreamID() string {
  56. return e.ConnID
  57. }
  58. func (e EventDomainFronting) Timestamp() time.Time {
  59. return e.CreatedAt
  60. }
  61. type EventConcurrencyLimited struct {
  62. CreatedAt time.Time
  63. }
  64. func (e EventConcurrencyLimited) StreamID() string {
  65. return ""
  66. }
  67. func (e EventConcurrencyLimited) Timestamp() time.Time {
  68. return e.CreatedAt
  69. }
  70. type EventIPBlocklisted struct {
  71. CreatedAt time.Time
  72. RemoteIP net.IP
  73. }
  74. func (e EventIPBlocklisted) StreamID() string {
  75. return ""
  76. }
  77. func (e EventIPBlocklisted) Timestamp() time.Time {
  78. return e.CreatedAt
  79. }