haip

package
v6.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	// The common name of the certificate, usually a domain name
	CommonName string `json:"commonName,omitempty"`
	// The expiration date of the certificate in 'Y-m-d' format
	ExpirationDate string `json:"expirationDate,omitempty"`
	// The domain ssl certificate id
	ID int64 `json:"id,omitempty"`
}

Certificate struct for haip certificates it contains an ID, expiration date and common name

type Haip

type Haip struct {
	// HA-IP name
	Name string `json:"name"`
	// The description that can be set by the customer
	Description string `json:"description"`
	// HA-IP status, either 'active', 'inactive', 'creating'
	Status Status `json:"status"`
	// Whether load balancing is enabled for this HA-IP
	IsLoadBalancingEnabled bool `json:"isLoadBalancingEnabled"`
	// HA-IP load balancing mode: 'roundrobin', 'cookie', 'source'
	LoadBalancingMode LoadBalancingMode `json:"loadBalancingMode,omitempty"`
	// Cookie name to pin sessions on when using cookie balancing mode
	StickyCookieName string `json:"stickyCookieName,omitempty"`
	// The interval in milliseconds at which health checks are performed. The interval may not be smaller than 2000ms.
	HealthCheckInterval int64 `json:"healthCheckInterval,omitempty"`
	// The path (URI) of the page to check HTTP status code on
	HTTPHealthCheckPath string `json:"httpHealthCheckPath,omitempty"`
	// The port to perform the HTTP check on
	HTTPHealthCheckPort int `json:"httpHealthCheckPort,omitempty"`
	// Whether to use SSL when performing the HTTP check
	HTTPHealthCheckSsl bool `json:"httpHealthCheckSsl"`
	// HA-IP IPv4 address
	IPv4Address net.IP `json:"ipv4Address,omitempty"`
	// HA-IP IPv6 address
	IPv6Address net.IP `json:"ipv6Address,omitempty"`
	// HA-IP IP setup: 'both', 'noipv6', 'ipv6to4', 'ipv4to6'
	IPSetup IPSetup `json:"ipSetup"`
	// The PTR record for the HA-IP
	PtrRecord string `json:"ptrRecord,omitempty"`
	// The IPs attached to this haip
	IPAddresses []net.IP `json:"ipAddresses,omitempty"`
	// HA-IP TLS Mode: 'tls10_11_12', 'tls11_12', 'tls12'
	TLSMode TLSMode `json:"tlsMode"`
	// Whether or not another process is already doing stuff with this HA-IP
	IsLocked bool `json:"isLocked,omitempty"`
}

Haip struct for a Haip

type IPSetup

type IPSetup string

IPSetup is one of the following strings 'both', 'noipv6', 'ipv6to4', 'ipv4to6'

const (
	// IPSetupBoth accept ipv4 and ipv6 and forward them to separate ipv4 and ipv6 addresses
	IPSetupBoth IPSetup = "both"
	// IPSetupNoIPv6 do not accept ipv6 traffic
	IPSetupNoIPv6 IPSetup = "noipv6"
	// IPSetupIPv6to4 forward ipv6 traffic to ipv4
	IPSetupIPv6to4 IPSetup = "ipv6to4"
	// IPSetupIPv4to6 forward ipv4 traffic to ipv6
	IPSetupIPv4to6 IPSetup = "ipv4to6"
)

Definition of all of the possible ip setup options

type LoadBalancingMode

type LoadBalancingMode string

LoadBalancingMode is one of the following strings 'roundrobin', 'cookie', 'source'

const (
	// LoadBalancingModeRoundRobin is the LoadBalancing mode roundrobin for a Haip, forward to next address everytime
	LoadBalancingModeRoundRobin LoadBalancingMode = "roundrobin"
	// LoadBalancingModeCookie is the LoadBalancing mode cookie for a Haip, forward to a fixed server, based on the cookie
	LoadBalancingModeCookie LoadBalancingMode = "cookie"
	// LoadBalancingModeSource is the LoadBalancing mode source for a Haip, choose a server to forward based on the source address
	LoadBalancingModeSource LoadBalancingMode = "source"
)

Definition of all of the possible load balancing modes

type PortConfiguration

type PortConfiguration struct {
	// The port configuration ID
	ID int64 `json:"id,omitempty"`
	// A name describing the port
	Name string `json:"name"`
	// The port at which traffic arrives on your HA-IP
	SourcePort int `json:"sourcePort"`
	// The port at which traffic arrives on your attached IP address(es)
	TargetPort int `json:"targetPort"`
	// The mode determining how traffic is processed and forwarded: 'tcp', 'http', 'https', 'proxy', 'http2_https'
	Mode PortConfigurationMode `json:"mode"`
	// The mode determining how traffic between our load balancers and your attached IP address(es) is encrypted: 'off', 'on', 'strict'
	EndpointSslMode string `json:"endpointSslMode"`
}

PortConfiguration struct for a PortConfiguration

type PortConfigurationMode

type PortConfigurationMode string

PortConfigurationMode is one of the following strings 'tcp', 'http', 'https', 'proxy', 'http2_https'

const (
	// PortConfigurationModeTCP plain TCP forward to your VPS
	PortConfigurationModeTCP PortConfigurationMode = "tcp"
	// PortConfigurationModeHTTP appends a X-Forwarded-For header to HTTP requests with the original remote IP
	PortConfigurationModeHTTP PortConfigurationMode = "http"
	// PortConfigurationModeHTTPS same as HTTP, with SSL Certificate offloading
	PortConfigurationModeHTTPS PortConfigurationMode = "https"
	// PortConfigurationModePROXY proxy protocol is also a way to retain the original remote IP,
	// but also works for non HTTP traffic (note: the receiving application has to support this)
	PortConfigurationModePROXY PortConfigurationMode = "proxy"
	// PortConfigurationModeHTTP2HTTPS same as HTTPS, with http/2 support
	PortConfigurationModeHTTP2HTTPS PortConfigurationMode = "http2_https"
)

Definition of all of the possible port configuration modes

type Repository

type Repository repository.RestRepository

Repository can be used to get a list of your Haips order new ones, changing specific Haip properties Updating the attached ssl certificates and attaching/detaching IP addresses to the HAIP

func (*Repository) AddCertificate

func (r *Repository) AddCertificate(haipName string, sslCertificateID int64) error

AddCertificate allows you to add a DV, OV or EV Certificate to Haip for SSL offloading Enable HTTPS mode in Configuration to use these certificates

func (*Repository) AddLetsEncryptCertificate

func (r *Repository) AddLetsEncryptCertificate(haipName string, commonName string) error

AddLetsEncryptCertificate allows you to add a LetsEncrypt certificate to your HA-IP. We will take care of all the validation and renewals.

In order to provide free LetsEncrypt certificates for the domains on your HA-IP, some requirements must be met in order to complete the certificate request:

  • DNS: the given CommonName must resolve to the HA-IP IP. IPv6 is not required, but when set, it must resolve to the HA-IP IPv6;
  • Configuration: LetsEncrypt verifies domains with a HTTP call to /.well-know. When requesting a LetsEncrypt certificate, our proxies will handle all ACME requests to automatically verify the certificate. To achieve this, the HA-IP must have a HTTP portConfiguration on port 80. When using this, you will also no longer be able to verify your own LetsEncrypt certificates via HA-IP.

For more information, see: https://api.transip.nl/rest/docs.html#ha-ip-ha-ip-certificates-post-1

func (*Repository) AddPortConfiguration

func (r *Repository) AddPortConfiguration(haipName string, configuration PortConfiguration) error

AddPortConfiguration allows you to Add PortConfigurations to your HA-IP to route traffic to your attached IP address(es)

Mode options:

  • http: appends a X-Forwarded-For header to HTTP requests with the original remote IP;
  • https: same as HTTP, with SSL Certificate offloading;
  • http2_https: same as HTTPS, with http/2 support;
  • tcp: plain TCP forward to your attached IP address(es);
  • proxy: proxy protocol is also a way to retain the original remote IP, but also works for non HTTP traffic (note: the receiving application has to support this).

Endpoint SSL mode options:

  • off: no SSL connection is established between our load balancers and your attached IP address(es);
  • on: an SSL connection is established between our load balancers your attached IP address(es), but the certificate is not validated;
  • strict: an SSL connection is established between our load balancers your attached IP address(es), and the certificate must signed by a trusted Certificate Authority.

For more information, see https://api.transip.nl/rest/docs.html#ha-ip-ha-ip-port-configurations-post

func (*Repository) Cancel

func (r *Repository) Cancel(haipName string, endTime gotransip.CancellationTime) error

Cancel will cancel the Haip, thus deleting it

func (*Repository) DetachCertificate

func (r *Repository) DetachCertificate(haipName string, certificateID int64) error

DetachCertificate detaches a certificate from a Haip by certificateId

func (*Repository) DetachIPAddresses

func (r *Repository) DetachIPAddresses(haipName string) error

DetachIPAddresses allows you to detach all IP Addresses from a Haip

func (*Repository) GetAll

func (r *Repository) GetAll() ([]Haip, error)

GetAll returns an array of all Haips in your account

func (*Repository) GetAllCertificates

func (r *Repository) GetAllCertificates(haipName string) ([]Certificate, error)

GetAllCertificates will return a list of certificates currently attached to the given Haip

func (*Repository) GetAttachedIPAddresses

func (r *Repository) GetAttachedIPAddresses(haipName string) ([]net.IP, error)

GetAttachedIPAddresses returns a list of currently attached IP address(es) to your Haip

func (*Repository) GetByName

func (r *Repository) GetByName(haipName string) (Haip, error)

GetByName returns information on a specific Haip by name

func (*Repository) GetPortConfiguration

func (r *Repository) GetPortConfiguration(haipName string, portConfigurationID int64) (PortConfiguration, error)

GetPortConfiguration returns the Configuration struct for a given Configuration by id

func (*Repository) GetPortConfigurations

func (r *Repository) GetPortConfigurations(haipName string) ([]PortConfiguration, error)

GetPortConfigurations returns a list of all PortConfigurations on the given Haip

func (*Repository) GetSelection

func (r *Repository) GetSelection(page int, itemsPerPage int) ([]Haip, error)

GetSelection returns a limited list of your Haips, specify how many and which page/chunk of Haips you want to retrieve

func (*Repository) GetStatusReport

func (r *Repository) GetStatusReport(haipName string) ([]StatusReport, error)

GetStatusReport returns a StatusReport per attached IP address, IP version, port and load balancer. You can use this method to monitor / verify the status of your HA-IP and attached IP addresses

func (*Repository) Order

func (r *Repository) Order(productName string, description string) error

Order allows you to order a new Haip

func (*Repository) OrderWithResponse added in v6.18.0

func (r *Repository) OrderWithResponse(productName string, description string) (rest.Response, error)

OrderWithResponse allows you to order a new Haip and returns a response

func (*Repository) RemovePortConfiguration

func (r *Repository) RemovePortConfiguration(haipName string, portConfigurationID int64) error

RemovePortConfiguration allows you to remove a port configuration

func (*Repository) SetAttachedIPAddresses

func (r *Repository) SetAttachedIPAddresses(haipName string, ipAddresses []net.IP) error

SetAttachedIPAddresses allows you to replace the IP address(es) attached your Haip

func (*Repository) Update

func (r *Repository) Update(haip Haip) error

Update allows you to alter your Haip in several ways outlined below:

  • Set the description of a HA-IP;
  • Set the PTR record;
  • Set the httpHealthCheckPath, must start with a /;
  • Set the httpHealthCheckPort, the port must be configured on the HA-IP PortConfigurations.

Load balancing options (loadBalancingMode):

  • roundrobin: forward to next address everytime;
  • cookie: forward to a fixed server, based on the cookie;
  • source: choose a server to forward to based on the source address.

IP setup options (ipSetup):

  • both: accept ipv4 and ipv6 and forward them to separate ipv4 and ipv6 addresses;
  • noipv6: do not accept ipv6 traffic;
  • ipv6to4: forward ipv6 traffic to ipv4.
  • ipv4to6: forward ipv4 traffic to ipv6.

TLS options (tlsMode):

  • tls10_11_12: only allow incoming tls traffic with versions 1.0, 1.1 and 1.2;
  • tls11_12: only allow incoming tls traffic with version 1.1 or 1.2;
  • tls12: only allow incoming traffic with tls version 1.2.

For more information see: https://api.transip.nl/rest/docs.html#ha-ip-ha-ip-put

func (*Repository) UpdatePortConfiguration

func (r *Repository) UpdatePortConfiguration(haipName string, configuration PortConfiguration) error

UpdatePortConfiguration allows you to update:

Name, SourcePort, TargetPort, Mode, or EndpointSslMode of a Configuration

For more information on these fields see the AddPortConfiguration method and: https://api.transip.nl/rest/docs.html#ha-ip-ha-ip-port-configurations-put

type Status

type Status string

Status is one of the following strings 'active', 'inactive', 'creating'

const (
	// HaipStatusActive is the status field for an active Haip, ready to use
	HaipStatusActive Status = "active"
	// HaipStatusInactive is the status field for an inactive Haip, not usable, please contact support
	HaipStatusInactive Status = "inactive"
	// HaipStatusCreating is the status field for a Haip that is being created
	HaipStatusCreating Status = "creating"
)

Definition of all of the possible haip statuses

type StatusReport

type StatusReport struct {
	// Attached IP address this status report is for
	IPAddress net.IP `json:"ipAddress,omitempty"`
	// IP Version 4,6
	IPVersion int `json:"ipVersion,omitempty"`
	// Last change in the state in Europe/Amsterdam timezone
	LastChange rest.Time `json:"lastChange,omitempty"`
	// The IP address of the HA-IP load balancer
	LoadBalancerIP net.IP `json:"loadBalancerIp,omitempty"`
	// The name of the load balancer
	LoadBalancerName string `json:"loadBalancerName,omitempty"`
	// HA-IP Configuration port
	Port int `json:"port,omitempty"`
	// The state of the load balancer, either 'up' or 'down'
	State string `json:"state,omitempty"`
}

StatusReport struct for a StatusReport

type TLSMode added in v6.3.0

type TLSMode string

TLSMode is one of the following strings 'tls10_11_12', 'tls11_12', 'tls12'

const (
	// TLSModeMinTLS10 only allow incoming tls traffic with versions 1.0, 1.1 and 1.2
	TLSModeMinTLS10 TLSMode = "tls10_11_12"
	// TLSModeMinTLS11 only allow incoming tls traffic with version 1.1 or 1.2
	TLSModeMinTLS11 TLSMode = "tls11_12"
	// TLSModeMinTLS12 only allow incoming traffic with tls version 1.2
	TLSModeMinTLS12 TLSMode = "tls12"
)

Definition of all of the possible tls mode options

Jump to

Keyboard shortcuts

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