Add EventTraffic

This commit is contained in:
9seconds
2021-03-22 17:54:46 +03:00
parent 925a02dac3
commit 42160a08fe
18 changed files with 569 additions and 55 deletions
+15 -7
View File
@@ -9,12 +9,13 @@ import (
)
type streamContext struct {
ctx context.Context
ctxCancel context.CancelFunc
clientConn net.Conn
connID string
dc int
logger Logger
ctx context.Context
ctxCancel context.CancelFunc
clientConn net.Conn
telegramConn net.Conn
connID string
dc int
logger Logger
}
func (s *streamContext) Deadline() (time.Time, bool) {
@@ -35,7 +36,14 @@ func (s *streamContext) Value(key interface{}) interface{} {
func (s *streamContext) Close() {
s.ctxCancel()
s.clientConn.Close()
if s.clientConn != nil {
s.clientConn.Close()
}
if s.telegramConn != nil {
s.telegramConn.Close()
}
}
func (s *streamContext) ClientIP() net.IP {