Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapIfFail ¶
WrapIfFail executes the provided function. If the function succeeds it simply returns the original error (that can be nil). If the function fails then it assesses if an original error was provided and wraps it if true. This function is a sugar to be used at when deferring function that can also return errors, we don't want to loose any context.
Types ¶
type Configuration ¶
type Configuration struct {
// Logf is a function that will be used to log messages. If not
// provided the default logger will be used.
Logf func(string, ...interface{})
// Port is the port to use for the UDP and TCP pings.
Port int
// Timeout is the timeout for the UDP and TCP connection to finish.
Timeout time.Duration
}
Configuration holds the runtime configuration for this package.
func NewConfiguration ¶
func NewConfiguration(options ...Option) Configuration
NewConfiguration creates a new configuration with the provided options.
type NamespacePinger ¶
func NewNamespacePinger ¶
func NewNamespacePinger(_, _ string, _ ...Option) (*NamespacePinger, error)
func (*NamespacePinger) Close ¶
func (n *NamespacePinger) Close() error
func (*NamespacePinger) StartTCPEchoServer ¶
func (n *NamespacePinger) StartTCPEchoServer(errors chan error)
func (*NamespacePinger) StartUDPEchoServer ¶
func (n *NamespacePinger) StartUDPEchoServer(errors chan error)
type Option ¶
type Option func(*Configuration)
Option is a function that sets an optional configuration.
func WithTimeout ¶
WithTimeout sets the timeout for the UDP and TCP connections.
Click to show internal directories.
Click to hide internal directories.