mirror of
https://github.com/SagerNet/sing.git
synced 2025-03-31 10:27:39 +03:00
Minor fixes
This commit is contained in:
parent
26511a251f
commit
0acb36c118
2 changed files with 8 additions and 7 deletions
|
@ -8,10 +8,6 @@ linters:
|
|||
- paralleltest
|
||||
- ineffassign
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
linters-settings:
|
||||
gci:
|
||||
custom-order: true
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
package exceptions
|
||||
|
||||
import "net"
|
||||
import (
|
||||
"errors"
|
||||
"net"
|
||||
)
|
||||
|
||||
type TimeoutError interface {
|
||||
Timeout() bool
|
||||
}
|
||||
|
||||
func IsTimeout(err error) bool {
|
||||
if netErr, isNetErr := err.(net.Error); isNetErr {
|
||||
var netErr net.Error
|
||||
if errors.As(err, &netErr) {
|
||||
//goland:noinspection GoDeprecation
|
||||
//nolint:staticcheck
|
||||
return netErr.Temporary() && netErr.Timeout()
|
||||
} else if timeoutErr, isTimeout := Cast[TimeoutError](err); isTimeout {
|
||||
}
|
||||
if timeoutErr, isTimeout := Cast[TimeoutError](err); isTimeout {
|
||||
return timeoutErr.Timeout()
|
||||
}
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue