From f7c33ee333353c940bdadbe731a7607b78bf760a Mon Sep 17 00:00:00 2001 From: 9seconds Date: Mon, 22 Mar 2021 18:41:54 +0300 Subject: [PATCH] Actually embedd connStandard into connEventTraffic --- mtglib/conns.go | 10 +++++----- mtglib/proxy.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mtglib/conns.go b/mtglib/conns.go index 685c7db..6793daf 100644 --- a/mtglib/conns.go +++ b/mtglib/conns.go @@ -53,7 +53,7 @@ func (c connStandard) SetWriteDeadline(t time.Time) error { } type connEventTraffic struct { - net.Conn + connStandard connID string stream EventStream @@ -61,7 +61,7 @@ type connEventTraffic struct { } func (c connEventTraffic) Read(b []byte) (int, error) { - n, err := c.Conn.Read(b) + n, err := c.connStandard.Read(b) if n > 0 { c.stream.Send(c.ctx, EventTraffic{ @@ -72,11 +72,11 @@ func (c connEventTraffic) Read(b []byte) (int, error) { }) } - return n, err // nolint: wrapcheck + return n, err } func (c connEventTraffic) Write(b []byte) (int, error) { - n, err := c.Conn.Write(b) + n, err := c.connStandard.Write(b) if n > 0 { c.stream.Send(c.ctx, EventTraffic{ @@ -87,5 +87,5 @@ func (c connEventTraffic) Write(b []byte) (int, error) { }) } - return n, err // nolint: wrapcheck + return n, err } diff --git a/mtglib/proxy.go b/mtglib/proxy.go index 9cedf31..d25f3c9 100644 --- a/mtglib/proxy.go +++ b/mtglib/proxy.go @@ -130,7 +130,7 @@ func (p *Proxy) doTelegramCall(ctx *streamContext) error { } ctx.telegramConn = connEventTraffic{ - Conn: connStandard{ + connStandard: connStandard{ conn: conn, idleTimeout: p.idleTimeout, },