github.com/apernet/sing-tun@v0.2.6-0.20240323130332-b9f6511036ad/errors_patch.go (about) 1 package tun 2 3 // isErrNotPollable returns true if the error is internal/poll.ErrNotPollable. 4 func isErrNotPollable(err error) bool { 5 if err == nil { 6 return false 7 } 8 if err.Error() == "not pollable" { 9 return true 10 } 11 12 switch err := err.(type) { 13 case interface{ Unwrap() error }: 14 return isErrNotPollable(err.Unwrap()) 15 case interface{ Unwrap() []error }: 16 for _, e := range err.Unwrap() { 17 if isErrNotPollable(e) { 18 return true 19 } 20 } 21 } 22 23 return false 24 }