Rework events

This commit is contained in:
9seconds
2021-04-07 14:40:54 +03:00
parent b748603096
commit 463af648ce
13 changed files with 275 additions and 410 deletions
+3 -5
View File
@@ -8,14 +8,12 @@ import (
"time"
)
const ConnectionIDBytesLength = 16
type streamContext struct {
ctx context.Context
ctxCancel context.CancelFunc
clientConn net.Conn
telegramConn net.Conn
connID string
streamID string
dc int
logger Logger
}
@@ -64,10 +62,10 @@ func newStreamContext(ctx context.Context, logger Logger, clientConn net.Conn) *
ctx: ctx,
ctxCancel: cancel,
clientConn: clientConn,
connID: base64.RawURLEncoding.EncodeToString(connIDBytes),
streamID: base64.RawURLEncoding.EncodeToString(connIDBytes),
}
streamCtx.logger = logger.
BindStr("stream-id", streamCtx.connID).
BindStr("stream-id", streamCtx.streamID).
BindStr("client-ip", streamCtx.ClientIP().String())
return streamCtx