mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 23:04:02 +03:00
Merge pull request #253 from 9seconds/cannot-dial-err
More correct error if no addresses are found
This commit is contained in:
@@ -2,10 +2,13 @@ package telegram
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/9seconds/mtg/v2/essentials"
|
||||
)
|
||||
|
||||
var ErrNoAddresses = errors.New("no addresses")
|
||||
|
||||
type preferIP uint8
|
||||
|
||||
const (
|
||||
|
||||
@@ -28,10 +28,9 @@ func (t Telegram) Dial(ctx context.Context, dc int) (essentials.Conn, error) {
|
||||
addresses = append(t.pool.getV6(dc), t.pool.getV4(dc)...)
|
||||
}
|
||||
|
||||
var (
|
||||
conn essentials.Conn
|
||||
err error
|
||||
)
|
||||
var conn essentials.Conn
|
||||
|
||||
err := ErrNoAddresses
|
||||
|
||||
for _, v := range addresses {
|
||||
conn, err = t.dialer.DialContext(ctx, v.network, v.address)
|
||||
|
||||
Reference in New Issue
Block a user