Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Protocol and port maps ProtocolPorts = map[string]int{ "http": 80, "ssh": 22, "telnet": 23, "smtp": 25, "dns": 53, "ntp": 123, "ldap": 389, "https": 443, "ldaps": 636, } ProtocolTransports = map[string][]string{ "tcp": []string{"tcp"}, "udp": []string{"udp"}, "http": []string{"tcp"}, "telnet": []string{"tcp"}, "smtp": []string{"tcp"}, "dns": []string{"udp", "tcp"}, "ntp": []string{"udp"}, "ldap": []string{"tcp"}, "https": []string{"tcp"}, "ldaps": []string{"tcp"}, } // Errors ErrMissingProtocol = errors.New("Target is missing protocol") ErrUnknownProtocol = errors.New("Unknown network protocol") )
Functions ¶
func GetProtocol ¶
GetProtocol returns the common application protocol string for the given port number.
func GetTransport ¶
GetTransport returns the common transport protocols for the given application protocol string.
Types ¶
type Target ¶
type Target interface { // Get returns the value for the given key name of the target's // attribute. Keys include: // - alive // - host // - port // - protocol // - type Get(key string) string // IsAlive returns true if the target is set alive. IsAlive() bool // IsAvailable tries to dial the target with the given timeout and // returns true if the connection succeeded. IsAvailable(to time.Duration) bool // SetAlive sets the alive attribute of the target. SetAlive(v bool) // Summary returns a comma-separated string of key-value pairs of the // target's attributes. Summary() string // URL returns a URL formatted string of the target. // ("<scheme>://<host>[:<port>]") URL() string }
Target represents an interface to a load balancer target.
func NewServiceTarget ¶
NewServiceTarget returns a new service target for the given URL.
type TargetGroup ¶
type TargetGroup struct { Name string // Group name Protocol string // Common group protocol Rule rules.Rule // Request rule Targets []Target // List of targets }
TargetGroup represents a group of targets.
func NewTargetGroup ¶
func NewTargetGroup(name, protocol string, rule rules.Rule, target ...Target) *TargetGroup
NewTargetGroup returns a new TargetGroup.
func (*TargetGroup) AddServiceTarget ¶
func (tg *TargetGroup) AddServiceTarget(target *url.URL)
AddServiceTarget adds a new target as a service via a given URL.
func (*TargetGroup) AddTarget ¶
func (tg *TargetGroup) AddTarget(host string, port int)
AddTarget adds a new target via a given host and port.
type TargetType ¶
type TargetType uint32
TargetType represents a type of load balancer target type.
const ( // Target types TargetTypeIP TargetType = iota + 1 TargetTypeDomain )
func (TargetType) String ¶
func (tt TargetType) String() string
String returns the string representation of the target type.
Click to show internal directories.
Click to hide internal directories.