tcp-shaker/err.go

33 lines
850 B
Go
Raw Permalink Normal View History

// +build darwin linux
2016-06-01 04:07:09 +00:00
package tcp
2016-06-01 09:45:24 +00:00
import (
"errors"
"golang.org/x/sys/unix"
2016-06-01 09:45:24 +00:00
)
2016-06-01 04:07:09 +00:00
// ErrTimeout indicates I/O timeout
var ErrTimeout = &timeoutError{}
type timeoutError struct{}
func (e *timeoutError) Error() string { return "I/O timeout" }
func (e *timeoutError) Timeout() bool { return true }
func (e *timeoutError) Temporary() bool { return true }
2016-06-01 09:47:04 +00:00
// ErrConnect is an error occurs while connecting to the host
// To get the detail of underlying error, lookup ErrorCode() in 'man 2 connect'
type ErrConnect struct {
error
2016-06-01 09:47:04 +00:00
}
2016-07-22 11:31:45 +00:00
// newErrConnect returns a ErrConnect with given error code
2016-06-01 09:47:04 +00:00
func newErrConnect(errCode int) *ErrConnect {
return &ErrConnect{unix.Errno(errCode)}
2016-06-01 09:47:04 +00:00
}
// ErrCheckerAlreadyStarted indicates there is another instance of CheckingLoop running.
var ErrCheckerAlreadyStarted = errors.New("Checker was already started")