mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 09:14:01 +03:00
Use CloseRead and CloseWrites
This commit is contained in:
@@ -2,7 +2,8 @@ package telegram
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
|
||||
"github.com/9seconds/mtg/v2/essentials"
|
||||
)
|
||||
|
||||
type preferIP uint8
|
||||
@@ -82,5 +83,5 @@ var (
|
||||
)
|
||||
|
||||
type Dialer interface {
|
||||
DialContext(ctx context.Context, network, address string) (net.Conn, error)
|
||||
DialContext(ctx context.Context, network, address string) (essentials.Conn, error)
|
||||
}
|
||||
|
||||
@@ -3,8 +3,9 @@ package telegram
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/9seconds/mtg/v2/essentials"
|
||||
)
|
||||
|
||||
type Telegram struct {
|
||||
@@ -13,7 +14,7 @@ type Telegram struct {
|
||||
pool addressPool
|
||||
}
|
||||
|
||||
func (t Telegram) Dial(ctx context.Context, dc int) (net.Conn, error) {
|
||||
func (t Telegram) Dial(ctx context.Context, dc int) (essentials.Conn, error) {
|
||||
var addresses []tgAddr
|
||||
|
||||
switch t.preferIP {
|
||||
@@ -28,7 +29,7 @@ func (t Telegram) Dial(ctx context.Context, dc int) (net.Conn, error) {
|
||||
}
|
||||
|
||||
var (
|
||||
conn net.Conn
|
||||
conn essentials.Conn
|
||||
err error
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user