| 1 | //go:build windows |
| 2 | |
| 3 | package forward |
| 4 | |
| 5 | import ( |
| 6 | "errors" |
| 7 | "syscall" |
| 8 | |
| 9 | "golang.org/x/sys/windows" |
| 10 | ) |
| 11 | |
| 12 | // isAddrInUse reports whether err is an "address already in use" bind error. |
| 13 | // Windows reports WSAEADDRINUSE from the Winsock layer; the portable |
| 14 | // EADDRINUSE is checked too for defensiveness. |
| 15 | func isAddrInUse(err error) bool { |
| 16 | return errors.Is(err, windows.WSAEADDRINUSE) || errors.Is(err, syscall.EADDRINUSE) |
| 17 | } |
| 18 |