Documentation ¶
Index ¶
Constants ¶
View Source
const ( UP = RegistrationStatus("UP") DOWN = RegistrationStatus("DOWN") )
Variables ¶
View Source
var ErrInvalidHostIP = errors.New("invalid hostname or ip address")
View Source
var ErrInvalidHostname = errors.New("invalid hostname")
View Source
var ErrInvalidPort = errors.New("invalid port")
Functions ¶
func EncodeHostnameToKey ¶
EncodeHostnameToKey will replace the . and : characters in a hostname with a dash
Types ¶
type DirectorOptsFunc ¶
type DirectorOptsFunc func(config *directorRegistrationOpts) error
func WithAuthorization ¶
func WithAuthorization(authorization string) DirectorOptsFunc
WithAuthorization will set the authorization
func WithInterval ¶
func WithInterval(interval time.Duration) DirectorOptsFunc
WithInterval will change the duration renewal time
func WithURL ¶
func WithURL(url string) DirectorOptsFunc
WithURL will allow the director url to be overriden from the default value
type DirectorRegister ¶
type DirectorRegister interface { // Close will unregister and then shutdown Close() error }
func NewRegistration ¶
func NewRegistration(logger logger.Logger, hostname string, hostIP string, port int, opts ...DirectorOptsFunc) (DirectorRegister, error)
NewRegistration will create a director registration for hostname with upstream hostIP and port
type Registration ¶
type Registration struct { Timestamp time.Time `json:"timestamp"` Status RegistrationStatus `json:"status"` Region string `json:"region"` IPAddress string `json:"ipAddress"` Port *int `json:"port,omitempty"` Hostname string `json:"hostname"` }
Registration is a record for director registration
func (Registration) GetPort ¶
func (r Registration) GetPort() int
GetPort will return a port using default if not provided
func (Registration) IsUP ¶
func (r Registration) IsUP() bool
IsUP returns true if this is an up status
func (Registration) Key ¶
func (r Registration) Key() string
Key should return a suitable cache key using the host ip and port
type RegistrationStatus ¶
type RegistrationStatus string
Click to show internal directories.
Click to hide internal directories.