port

package
v0.0.0-...-02c76fb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionCheck

type ConnectionCheck interface {
	CheckConnection(host string, port int) error
}

ConnectionCheck represents a connection checker

type Port

type Port struct {
	*wait.Retrier

	// the hostname
	Host string `export:"host"`

	// the TCP port
	Port int `export:"port"`

	ConnectionCheck
}

Port represents a port check

func (*Port) Apply

Apply retries the check until it passes or returns max failure threshold

func (*Port) Check

Check if the port is open

func (*Port) CheckConnection

func (p *Port) CheckConnection() error

CheckConnection attempts to see if a tcp port is open

type Preparer

type Preparer struct {
	// a host name or ip address. A TCP connection will be attempted at this host
	// and the specified Port. default: localhost
	Host string `hcl:"host"`

	// the TCP port to attempt to connect to.
	Port int `hcl:"port" required:"true"`

	// the amount of time to wait in between checks. If the interval is not
	// specified, it will default to 5 seconds.
	Interval *time.Duration `hcl:"interval"`

	// the amount of time to wait before running the first check and after a
	// successful check. If no grace period is specified, no grace period will be
	// taken into account.
	GracePeriod *time.Duration `hcl:"grace_period"`

	// the maximum number of attempts before the wait fails. If the maximum number
	// of retries is not set, it will default to 5.
	MaxRetry *int `hcl:"max_retry"`
}

Preparer handles wait.query tasks

func (*Preparer) Prepare

func (p *Preparer) Prepare(ctx context.Context, render resource.Renderer) (resource.Task, error)

Prepare creates a new wait.port type

type TCPConnectionCheck

type TCPConnectionCheck struct{}

TCPConnectionCheck impelements a ConnectionCheck over TCP

func (*TCPConnectionCheck) CheckConnection

func (t *TCPConnectionCheck) CheckConnection(host string, port int) error

CheckConnection attempts to see if a tcp port is open

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL