refused_windows.go 368 B

123456789101112131415
  1. package fetch
  2. import (
  3. "errors"
  4. "syscall"
  5. )
  6. // wsaeconnrefused is Winsock's "connection refused" error, which Windows
  7. // returns instead of syscall.ECONNREFUSED. The syscall package doesn't
  8. // define it.
  9. const wsaeconnrefused syscall.Errno = 10061
  10. func isRefused(err error) bool {
  11. return errors.Is(err, wsaeconnrefused) || errors.Is(err, syscall.ECONNREFUSED)
  12. }