haip

package
v5.8.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCertificateFromHaip

func AddCertificateFromHaip(c gotransip.Client, haipName string, certificateID int64) error

AddCertificateFromHaip adds a certificate to given HA-IP

func AddPortConfiguration

func AddPortConfiguration(c gotransip.Client, haipName string, pc PortConfiguration) error

AddPortConfiguration adds a port configuration to given HA-IP

func CancelHaip

func CancelHaip(c gotransip.Client, haipName string, endTime gotransip.CancellationTime) error

CancelHaip cancels contract for HA-IP per endTime

func DeleteCertificateFromHaip

func DeleteCertificateFromHaip(c gotransip.Client, haipName string, certificateID int64) error

DeleteCertificateFromHaip removes a certificate from given HA-IP

func DeletePortConfiguration

func DeletePortConfiguration(c gotransip.Client, haipName string, ID int64) error

DeletePortConfiguration deletes a port configuration to given HA-IP

func GetPtrForHaip

func GetPtrForHaip(c gotransip.Client, haipName string) (string, error)

GetPtrForHaip returns the current PTR for the given HA-IP

func GetStatusReport

func GetStatusReport(c gotransip.Client, haipName string) error

GetStatusReport returns status report for given HA-IP

func SetBalancingMode

func SetBalancingMode(c gotransip.Client, haipName string, balancingMode BalancingMode, cookieName string) error

SetBalancingMode sets the provided balancing mode for the HA-IP. The cookieName argument may be an empty string unless the balancing mode is set to 'cookie'.

func SetDefaultPortConfiguration

func SetDefaultPortConfiguration(c gotransip.Client, haipName string) error

SetDefaultPortConfiguration reverts the port configuration to the default for given HA-IP

func SetHTTPHealthCheck

func SetHTTPHealthCheck(c gotransip.Client, haipName, path string, port int) error

SetHTTPHealthCheck configures a HTTP health check for the HA-IP. To disable a HTTP health check use SetTCPHealthCheck()

func SetHaipDescription

func SetHaipDescription(c gotransip.Client, haipName string, description string) error

SetHaipDescription updates the description for HA-IP

func SetHaipVpses

func SetHaipVpses(c gotransip.Client, haipName string, vpsNames []string) error

SetHaipVpses replaces currently attached VPSes to the HA-IP with the provided list of VPSes

func SetIPSetup

func SetIPSetup(c gotransip.Client, haipName string, setup IPSetup) error

SetIPSetup sets the IP setup for the HA-IP

func SetPtrForHaip

func SetPtrForHaip(c gotransip.Client, haipName string, ptr string) error

SetPtrForHaip updates the PTR records for the given HA-IP

func SetTCPHealthCheck

func SetTCPHealthCheck(c gotransip.Client, haipName string) error

SetTCPHealthCheck configures a TCP health check for the HA-IP (this is the default health check)

func StartHaipLetsEncryptCertificateIssue

func StartHaipLetsEncryptCertificateIssue(c gotransip.Client, haipName, commonName string) error

StartHaipLetsEncryptCertificateIssue adds Let's Encrypt SSL encryption to HA-IP for given commonName

func UpdatePortConfiguration

func UpdatePortConfiguration(c gotransip.Client, haipName string, pc PortConfiguration) error

UpdatePortConfiguration updates an existsing port configuration to given HA-IP

Types

type BalancingMode

type BalancingMode string

BalancingMode represents the possible load balancing modes configurable for HA-IP

var (
	// BalancingModeRoundRobin balances on a round-robin base
	BalancingModeRoundRobin BalancingMode = "roundrobin"
	// BalancingModeCookie balances based on a predefined cookie sent by the client
	// from the second request onwards
	BalancingModeCookie BalancingMode = "cookie"
	// BalancingModeSource balances based on the source address of the client
	BalancingModeSource BalancingMode = "source"
)

type Certificate

type Certificate struct {
	ID             int64
	CommonName     string
	ExpirationDate time.Time
}

Certificate represents a HA-IP certificate

func GetAvailableCertificatesByHaip

func GetAvailableCertificatesByHaip(c gotransip.Client, haipName string) ([]Certificate, error)

GetAvailableCertificatesByHaip returns all available certificates ready to attach to given HA-IP

func GetCertificatesByHaip

func GetCertificatesByHaip(c gotransip.Client, haipName string) ([]Certificate, error)

GetCertificatesByHaip returns all certificates attached given HA-IP

type EndpointSSLMode

type EndpointSSLMode string

EndpointSSLMode represents possible modes of encryption between HA-IP and VPSes

var (
	// EndpointSSLModeOff means traffic to VPSes is sent unencrypted
	EndpointSSLModeOff EndpointSSLMode = "off"
	// EndpointSSLModeOn means traffic to VPSes is sent encrypted, certificate can
	// be self-signed, no verification is applied
	EndpointSSLModeOn EndpointSSLMode = "on"
	// EndpointSSLModeStrict means traffic to VPSes is sent encrypted, certificate's
	// CA should be trusted
	EndpointSSLModeStrict EndpointSSLMode = "strict"
)

type Haip

type Haip struct {
	Name                   string          `xml:"name"`
	Status                 Status          `xml:"status"`
	IsBlocked              bool            `xml:"isBlocked"`
	IsLoadBalancingEnabled bool            `xml:"isLoadBalancingEnabled"`
	LoadBalancingMode      BalancingMode   `xml:"loadBalancingMode"`
	StickyCookieName       string          `xml:"stickyCookieName"`
	HealthCheckMode        HealthCheckMode `xml:"healthCheckMode"`
	HTTPHealthCheckPath    string          `xml:"httpHealthCheckPath"`
	HTTPHealthCheckPort    int             `xml:"httpHealthCheckPort"`
	IPv4Address            net.IP          `xml:"ipv4Address"`
	IPv6Address            net.IP          `xml:"ipv6Address"`
	IPSetup                IPSetup         `xml:"ipSetup"`
	AttachedVpses          []vps.Vps       `xml:"attachedVpses>item"`
}

Haip represents a Transip_Haip object https://api.transip.nl/docs/transip.nl/class-Transip_Haip.html

func GetHaip

func GetHaip(c gotransip.Client, haipName string) (Haip, error)

GetHaip returns Haip for given name or error if when it failed to retrieve Haip from API

func GetHaips

func GetHaips(c gotransip.Client) ([]Haip, error)

GetHaips returns slice of Haip structs or error when it failed to retrieve list of Haips from API

type HealthCheckMode

type HealthCheckMode string

HealthCheckMode represents the possible health checking modes configurable for HA-IP

var (
	// HealthCheckModeTCP checks whether the specified TCP port of a Vps is reachable
	HealthCheckModeTCP HealthCheckMode = "tcp"
	// HealthCheckModeHTTP performs HTTP requests based on HTTPHealthCheckPath and
	// httpHealthCheckPort
	HealthCheckModeHTTP HealthCheckMode = "http"
)

type IPSetup

type IPSetup string

IPSetup represents the possible ipSetups configurable for HA-IP

var (
	// IPSetupBoth forwards IPv4 and IPv6 to the VPS's respective addresses
	IPSetupBoth IPSetup = "both"
	// IPSetupNoIPv6 only forwards IPv4
	IPSetupNoIPv6 IPSetup = "noipv6"
	// IPSetupIPv6To4 forwards both IPv4 and IPv6 to the VPS's IPv4 address
	IPSetupIPv6To4 IPSetup = "ipv6to4"
	// IPSetupIPv4To6 forwards both IPv4 and IPv6 to the VPS's IPv6 address
	IPSetupIPv4To6 IPSetup = "ipv4to6"
)

type Mode

type Mode string

Mode represents possible modes a HA-IP can operate in

var (
	// ModeTCP operates in TCP mode
	ModeTCP Mode = "tcp"
	// ModeHTTP operates in HTTP mode
	ModeHTTP Mode = "http"
	// ModeHTTPS operates in HTTPS mode
	ModeHTTPS Mode = "https"
	// ModeProxy operates in haproxy's PROXY protocol
	ModeProxy Mode = "proxy"
)

type PortConfiguration

type PortConfiguration struct {
	ID              int64
	Name            string
	Mode            Mode
	SourcePort      int64
	TargetPort      int64
	EndpointSSLMode EndpointSSLMode
}

PortConfiguration represents a HA-IP's port configuration

func GetPortConfigurations

func GetPortConfigurations(c gotransip.Client, haipName string) ([]PortConfiguration, error)

GetPortConfigurations returns all port configurations for given HA-IP

type Status

type Status string

Status represents the possibles states a HA-IP can be in

var (
	// StatusCreated means the HA-IP was provisioned but not yet configured
	StatusCreated Status = "created"
	// StatusActive means the HA-IP is active
	StatusActive Status = "active"
	// StatusInactive means the HA-IP is deactiveated
	StatusInactive Status = "inactive"
)

type StatusReport

type StatusReport struct {
	PortConfiguration []statusReportPortConfiguration
}

StatusReport represents the structured data that is returned from GetStatusReport

Jump to

Keyboard shortcuts

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