Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error defines a structured error this package will use
type MultipleError ¶ added in v0.3.0
type MultipleError struct {
// contains filtered or unexported fields
}
MultipleError holds a set of errors
func NewMultipleError ¶ added in v0.3.0
func NewMultipleError(msg string, cap int) *MultipleError
NewMultipleError returns a new instance of a multiple error object. Any procedures that run in batch should use this error to represent problems somewhere down the chain. The parameter 'cap' lets you set the capacity of the internal slice beforehand to prevent memory allocations during filling.
func (*MultipleError) Add ¶ added in v0.3.0
func (me *MultipleError) Add(e Error) int
Add adds an Error instance to the MultipleErrors error set
func (*MultipleError) As ¶ added in v0.3.0
func (me *MultipleError) As(target interface{}) (matches bool)
As implements the interface the errors package can use to check for errors.As
func (*MultipleError) Error ¶ added in v0.3.0
func (me *MultipleError) Error() string
func (*MultipleError) Errors ¶ added in v0.3.0
func (me *MultipleError) Errors() []Error
Errors returns all the internal errors contained by this multiple error bucket
func (*MultipleError) Is ¶ added in v0.3.0
func (me *MultipleError) Is(target error) (matches bool)
Is implements the interface the errors package can use to match the MultipleError to an error that should be tested.
func (*MultipleError) Len ¶ added in v0.3.0
func (me *MultipleError) Len() int
Len gets the size of the internal error set
type Registrar ¶ added in v0.3.0
type Registrar interface {
// CheckDomain returns a status about the requested domain.
CheckDomain(string) (Status, error)
// Register domain will try and register the domain name
RegisterDomain(string) (Status, error)
}
Registrar interface defines some methods we want external services to present to us such as but not limited to domain availability checks and registration
type RegistrarStatus ¶ added in v0.3.0
type RegistrarStatus struct {
// contains filtered or unexported fields
}
ClientStatus tells the status for a domain for a specific domain
func CheckDomain ¶
func CheckDomain(name string, clients []Registrar) ([]RegistrarStatus, error)
CheckDomain will walk though the provided domainRegistrars and check on all of them if a specific domain is available. The domainClients will be checked in order of appearance. The returning error does not mean domain checking completely failed. It just states somewhere during checking an error occured at some registrar in the chain.
func RegisterDomain ¶
func RegisterDomain(name string, clients []Registrar) (RegistrarStatus, error)
RegisterDomain will try to register a domain at a slice of given domainRegistrars. The first one to return a valid response will own the domain. Please sort the domainClients in order of preference. Please check the RegistarStatus to see if the registration was a success. The error will contain any error that occured with any registrar during registration attempts.
func (*RegistrarStatus) Domain ¶ added in v0.3.0
func (cs *RegistrarStatus) Domain() string
Domain reports the domain name requested
func (*RegistrarStatus) Registrar ¶ added in v0.3.0
func (cs *RegistrarStatus) Registrar() Registrar
Registrar reports the registrar to which this status applies
func (*RegistrarStatus) Status ¶ added in v0.3.0
func (cs *RegistrarStatus) Status() Status
Status reports the actual status for this domain with this client
type Status ¶
type Status uint8
Status wraps statuses this package will act upon
var ( Unavailable Status = 0x00 // Owned status tells us the domain name is already in out possession Owned Status = 0x01 // Available status is the mark that we can try to claim the domain name Available Status = 0x02 // Processing is a special status that indicates we are already trying to get the domain Processing Status = 0x04 )