mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 23:14:02 +03:00
FILE / ScuroNeko/mtg
mtglib/internal/relay/conn.go
Исходный файл и его история в репозитории.
20 lines
308 B
Go
20 lines
308 B
Go
package relay
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
"time"
|
|
)
|
|
|
|
type conn struct {
|
|
net.Conn
|
|
}
|
|
|
|
func (c conn) Read(p []byte) (int, error) {
|
|
if err := c.SetReadDeadline(time.Now().Add(getTimeout())); err != nil {
|
|
return 0, fmt.Errorf("cannot set read deadline: %w", err)
|
|
}
|
|
|
|
return c.Conn.Read(p) // nolint: wrapcheck
|
|
}
|