mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-07-30 10:34:16 +03:00
Report invalid DNS address early
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/sagernet/sing-box/option"
|
||||
"github.com/sagernet/sing/common"
|
||||
"github.com/sagernet/sing/common/buf"
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
N "github.com/sagernet/sing/common/network"
|
||||
|
||||
@@ -37,7 +38,9 @@ func NewTCP(ctx context.Context, logger log.ContextLogger, tag string, options o
|
||||
return nil, err
|
||||
}
|
||||
serverAddr := options.DNSServerAddressOptions.Build()
|
||||
if serverAddr.Port == 0 {
|
||||
if !serverAddr.Addr.IsValid() {
|
||||
return nil, E.New("invalid server address: ", serverAddr)
|
||||
} else if serverAddr.Port == 0 {
|
||||
serverAddr.Port = 53
|
||||
}
|
||||
return &TCPTransport{
|
||||
|
||||
Reference in New Issue
Block a user