haproxymanager

package
v0.0.0-...-9663fe4 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPortRestrictedForManualConfig

func IsPortRestrictedForManualConfig(port int, restrictedPorts []int) bool

This function is used to check if a port is restricted or not for application.

There are some ports that are restricted. because those port are pre-occupied by Swarm services or other required services. So, binding to those ports will cause errors. That's why we need to restrict those ports before apply the config.

Types

type ListenerMode

type ListenerMode string
const (
	HTTPMode ListenerMode = "http"
	TCPMode  ListenerMode = "tcp"
)

type Manager

type Manager struct {
	Host string
	Port int
	// contains filtered or unexported fields
}

func (Manager) AddBackend

func (s Manager) AddBackend(transaction_id string, service_name string, port int, replicas int) (string, error)

Add Backend to HAProxy configuration -- Manage server template with backend

func (s Manager) AddHTTPLink(transaction_id string, backend_name string, domain_name string) error

Add HTTP Link [Backend Switch] to HAProxy configuration -- Manage ACLs with frontend [only domain_name] -- Manage rules with frontend and backend switch

func (Manager) AddHTTPRedirectRule

func (s Manager) AddHTTPRedirectRule(transaction_id string, match_domain string, redirect_url string) error

TODO: Support other http ports except 80 for Redirect Rules Add HTTP Redirect Rule

func (s Manager) AddHTTPSLink(transaction_id string, backend_name string, domain_name string) error

Add HTTPS Link [Backend Switch] to HAProxy configuration -- Manage ACLs with frontend [only domain_name] -- Manage rules with frontend and backend switch

func (s Manager) AddTCPLink(transaction_id string, backend_name string, port int, domain_name string, listenerMode ListenerMode, restrictedPorts []int) error

Add TCP Frontend to HAProxy configuration -- Manage ACLs with frontend [port{required} and domain_name{optional}] -- Manage rules with frontend and backend switch

func (*Manager) Auth

func (s *Manager) Auth(username string, password string)

Update auth credentials for HaProxy Manager

func (Manager) CommitTransaction

func (s Manager) CommitTransaction(transactionId string) error

Commit new transaction with force reload to apply changes

func (Manager) DeleteBackend

func (s Manager) DeleteBackend(transaction_id string, backend_name string) error

Delete Backend from HAProxy configuration

func (s Manager) DeleteHTTPLink(transaction_id string, backend_name string, domain_name string) error

Delete HTTP Link from HAProxy configuration

func (Manager) DeleteHTTPRedirectRule

func (s Manager) DeleteHTTPRedirectRule(transaction_id string, match_domain string) error

Delete HTTP Redirect Rule

func (s Manager) DeleteHTTPSLink(transaction_id string, backend_name string, domain_name string) error

Delete HTTPS Link from HAProxy configuration

func (s Manager) DeleteTCPLink(transaction_id string, backend_name string, port int, domain_name string, restrictedPorts []int) error

Delete TCP Frontend from HAProxy configuration

func (Manager) DeleteTransaction

func (s Manager) DeleteTransaction(transactionId string) error

Delete transaction

func (Manager) FetchNewTransactionId

func (s Manager) FetchNewTransactionId() (string, error)

Generate new transaction id

func (Manager) GenerateBackendName

func (s Manager) GenerateBackendName(service_name string, port int) string

Generate Backend name for HAProxy

func (*Manager) InitTcpSocket

func (s *Manager) InitTcpSocket(host string, port int)

Init HaProxy Manager with tcp socket info (host, port)

func (*Manager) InitUnixSocket

func (s *Manager) InitUnixSocket(unixSocketPath string)

Init HaProxy Manager with a unix socket

func (Manager) URI

func (s Manager) URI() string

Generate Base URI for HAProxy Server

func (Manager) UpdateSSL

func (s Manager) UpdateSSL(transaction_id string, domain string, privateKey []byte, fullChain []byte) error

Add SSL certificate to HAProxy

type QueryParameter

type QueryParameter struct {
	// contains filtered or unexported fields
}

type QueryParameters

type QueryParameters []QueryParameter

Jump to

Keyboard shortcuts

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