superclient

package
v0.0.0-...-4718e07 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const AuthInfoDictionary = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_[]{}\\|;:,<.>/?`~"

AuthInfoDictionary is a list of valid characters that may be used in an authInfo password.

Variables

View Source
var (
	// ErrResponseTimeout represnts a tiemout waiting for a server to
	// respond to a request.
	ErrResponseTimeout = errors.New("timeout occurred waiting for server response")

	// ErrUnknownCheckAvailableReturn is returned when a check request
	// returns something other than 0 or 1 for its availability.
	ErrUnknownCheckAvailableReturn = errors.New("check returned a non 0 or 1 value for availability")

	// ErrInvalidDomainReturned is returned when the domain that was
	// requested is not the domain that is returned.
	ErrInvalidDomainReturned = errors.New("domain name in resopnse was not the domain name requested")

	// ErrInvalidContactReturned is returned when the contact that was
	// requested is not the contact that is returned.
	ErrInvalidContactReturned = errors.New("contact name in resopnse was not the contact name requested")

	// ErrInvalidHostReturned is returned when the host that was requested
	// is not the host that is returned.
	ErrInvalidHostReturned = errors.New("host name in resopnse was not the host name requested")

	// ErrUnhandledResponse is returned when a response that is unhandled
	// by the application is found.
	ErrUnhandledResponse = errors.New("unhandled response")

	// ErrUnhandledPollMessage is returend when a poll message is not
	// handled properly.
	ErrUnhandledPollMessage = errors.New("unhandled poll messages")

	// ErrUnknownPollResponseCode indicates that the EPP response to a
	// poll message returned an unexpected respose code.
	ErrUnknownPollResponseCode = errors.New("unknown epp poll response code")

	// ErrUnexpectedReponse indicates that the EPP response received was
	// unexpected.
	ErrUnexpectedReponse = errors.New("unexpected epp response")
)

Functions

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomString

func GenerateRandomString(s int) (string, error)

GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GetAuthInfo

func GetAuthInfo() (ai string, err error)

GetAuthInfo will gerneate an AuthInfo password that will be used for a host or domain object. If a password cannot be generated, an error wiil be returned.

func IsValidAuthInfo

func IsValidAuthInfo(authInfo string) bool

IsValidAuthInfo takes a proposed AuthInfo password and will return true if matches the password requirements, otherwise false is returned.

Types

type PollResponse

type PollResponse struct {
	ID      string
	Message string

	DomainTransfer            *epp.DomainTrnDataResp
	IsDomainTransferApproved  bool
	IsDomainTransferRequested bool
	IsDomainTransferRejected  bool
	IsDomainTransferCancelled bool

	HostInf               *epp.HostInfDataResp
	IsUnusedObjectsPolicy bool
}

PollResponse represents a poll response object and exposes fields that indicate what type of message was received.

type SuperClient

type SuperClient struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

SuperClient is used to handle a easier interface to the EPP server.

func NewSuperClient

func NewSuperClient(config client.Config, log *logging.Logger, loginCallback func(lib.EPPAction), logoutCallback func(lib.EPPAction)) (sc *SuperClient, err error)

NewSuperClient takes the configuration information and a logger interface and will start a new EPP client and wait for the client to be ready for use before returning. If an error occurs while setting up the client, it will be returned.

func (*SuperClient) AckPoll

func (sc *SuperClient) AckPoll(messageID string) (action lib.EPPAction, err error)

AckPoll is used to acknowledge a message queue item to remove it from the queue.

func (*SuperClient) ApproveDomainTransfer

func (sc *SuperClient) ApproveDomainTransfer(domainName string) (responseCode int, action lib.EPPAction, err error)

ApproveDomainTransfer takes a domain name and will attempt to approve the domain transfer request for that domain. If the transfer approval does not succeed, an error and response code will be returned.

func (*SuperClient) DomainAddDSRecords

func (sc *SuperClient) DomainAddDSRecords(domainname string, records []epp.DSData) (responseCode int, action lib.EPPAction, err error)

DomainAddDSRecords will attempt to add the ds record(s) provided to the domain object. If an error occurs, the error and the response code will be returned.

func (*SuperClient) DomainAddHosts

func (sc *SuperClient) DomainAddHosts(domainname string, hosts []string) (responseCode int, action lib.EPPAction, err error)

DomainAddHosts will attempt to add the provided hosts to a domain object. If an error occurs, the error and the response code will be returned.

func (*SuperClient) DomainAddStatuses

func (sc *SuperClient) DomainAddStatuses(domainname string, statuses []string) (responseCode int, action lib.EPPAction, err error)

DomainAddStatuses will attempt to add the provided statuses to a domain object. If an error occurs, the error and the response code will be returned.

func (*SuperClient) DomainAvailable

func (sc *SuperClient) DomainAvailable(domainName string) (bool, string, lib.EPPAction, error)

DomainAvailable takes a domain name and will run a check command with the epp server and return true iff the domain is available and a reason for its availability if there is one. If an error occures during the process, an error is returned and the values for availability and reason are false and empty respectively. This function times out after the timeout defined by the server without a response.

func (*SuperClient) DomainChangeAuthInfo

func (sc *SuperClient) DomainChangeAuthInfo(domainname string, newAuthInfo string) (responseCode int, action lib.EPPAction, err error)

DomainChangeAuthInfo will attemtp to change the domain auth info value at the registry. If an error occurs, the error and the response will be returned.

func (*SuperClient) DomainCreate

func (sc *SuperClient) DomainCreate(domainName string, registrationYears int) (responseCode int, action lib.EPPAction, err error)

DomainCreate takes a domain name and the number of years to register the domain for and attempt to register the domain. If the domain registration is successful a response code of 1000 and no error will be returned, otherwise an error code and error object will be returned.

func (*SuperClient) DomainDelete

func (sc *SuperClient) DomainDelete(domainName string) (responseCode int, action lib.EPPAction, err error)

DomainDelete takes a domain name and will attempt to delete the domain object from the registry. In the event of an error processing the delete request, the error code and the error body will be returned.

func (*SuperClient) DomainInfo

func (sc *SuperClient) DomainInfo(domainName string, hosts epp.DomainInfoHosts, authInfo *string) (*epp.DomainInfDataResp, *epp.Response, lib.EPPAction, error)

DomainInfo takes a domain name and an indicator of which type of host information is desired and will attempt to send a domain info request to the epp server. If no error occurs, the domain info response object will be returned, otherwise an error will be returned.

func (*SuperClient) DomainRemoveDSRecords

func (sc *SuperClient) DomainRemoveDSRecords(domainname string, records []epp.DSData) (responseCode int, action lib.EPPAction, err error)

DomainRemoveDSRecords will attempt to remove the ds record(s) provided from domain object. If an error occurs, the error and the response code will be returned.

func (*SuperClient) DomainRemoveHosts

func (sc *SuperClient) DomainRemoveHosts(domainname string, hosts []string) (responseCode int, action lib.EPPAction, err error)

DomainRemoveHosts will attempt to remove the provided hosts from a domain object. If an error occurs, the error and the response code will be returned.

func (*SuperClient) DomainRemoveStatuses

func (sc *SuperClient) DomainRemoveStatuses(domainname string, statuses []string) (responseCode int, action lib.EPPAction, err error)

DomainRemoveStatuses will attempt to remove the provided statuses from a domain object. If an error occurs, the error and the response code will be returned.

func (*SuperClient) DomainRenew

func (sc *SuperClient) DomainRenew(domainname string, currentExpireDate string, duration epp.DomainPeriod) (responseCode int, action lib.EPPAction, err error)

DomainRenew will take a domain name, the current expire date and the duration for the renewal and try to send the renew request to the epp server. In the event that the renewal fails, an error and response code will be returned.

func (*SuperClient) HostAvailable

func (sc *SuperClient) HostAvailable(hostName string) (bool, lib.EPPAction, error)

HostAvailable takes a hostname name and will run a check command with the epp server and return true iff the host is available. If an error occures during the process, an error is returned and the availablility will be false. This function times out after the timeout defined by the server without a response.

func (*SuperClient) HostChangeIPAddresses

func (sc *SuperClient) HostChangeIPAddresses(hostname string, ipv4Add []string, ipv4Rem []string, ipv6Add []string, ipv6Rem []string) (responseCode int, action lib.EPPAction, err error)

HostChangeIPAddresses will take the hostname and the list of IPs to either add or remove (both v4 and v6) from the host object and attempt to send the request to the registry. If an error occurs, the response code and error will be returned.

func (*SuperClient) HostCreate

func (sc *SuperClient) HostCreate(hostname string, ipv4 []string, ipv6 []string) (responseCode int, action lib.EPPAction, err error)

HostCreate takes a hostname in addition to two lists of IP address, one for IPv4 and IPv6, and will attempt to create the host object. If the host creation fails and error and response code will be returned.

func (*SuperClient) HostDelete

func (sc *SuperClient) HostDelete(hostname string) (responseCode int, action lib.EPPAction, err error)

HostDelete takes a hostname and will attempt to delete the hostname from the registry. If there is an error with the delete operation the response code and the error will be returned.

func (*SuperClient) HostInfo

func (sc *SuperClient) HostInfo(hostName string) (*epp.HostInfDataResp, *epp.Response, lib.EPPAction, error)

HostInfo takes a hostname and will attempt to send a host info request to the epp server. If no error occurs, the host info response object will be returned, otherwise an error will be returned.

func (*SuperClient) HostStatusUpdate

func (sc *SuperClient) HostStatusUpdate(hostname string, clientUpdate *bool, clientDelete *bool) (responseCode int, action lib.EPPAction, err error)

HostStatusUpdate will take the hostname and the up to two boolean pointers and either add or remove the status flags that correspond to each of the options at the registry. If an error occurs, the response code and error will be returned.

func (*SuperClient) Logout

func (sc *SuperClient) Logout() (lib.EPPAction, error)

Logout will send a logout request to the underlying client in order to shut the client down and disconnect from the server.

func (*SuperClient) PollRequest

func (sc *SuperClient) PollRequest() (hasMessages bool, pr *PollResponse, action lib.EPPAction, err error)

PollRequest is used to send a poll request to the EPP server to get the first object, if any exit.

func (*SuperClient) QueryDomainTransfer

func (sc *SuperClient) QueryDomainTransfer(domainName string) (trResp *epp.DomainTrnDataResp, action lib.EPPAction, err error)

QueryDomainTransfer takes a domain name and will query its transfer status and return the doamin transfer object if it exists, otherwise an error is returned.

func (*SuperClient) RejectDomainTransfer

func (sc *SuperClient) RejectDomainTransfer(domainName string) (responseCode int, action lib.EPPAction, err error)

RejectDomainTransfer takes a dmoain name and will attempt to reject the domain transfer request. If the transfer reject does not succeed an error and response code will be returned.

func (*SuperClient) RequestDomainTransfer

func (sc *SuperClient) RequestDomainTransfer(domainName string, authInfo string) (trResp *epp.DomainTrnDataResp, responseCode int, action lib.EPPAction, err error)

RequestDomainTransfer will take a domain name and the authorization info password and attempt to request a domain transfer for the given domain. If the transfer request does not succeed, a response code and an error will be returned otherwise the domain transfer object will returned.

func (*SuperClient) SendHello

func (sc *SuperClient) SendHello() (responseCode int, action lib.EPPAction, err error)

SendHello will send a hello message to the registry and return a response code and an error if an error occurs.

func (*SuperClient) StatusWatcher

func (sc *SuperClient) StatusWatcher()

StatusWatcher will watch for status channel updates and log them to the debug stream of the log function.

func (*SuperClient) SyncDomain

func (sc *SuperClient) SyncDomain(domainname string, month time.Month, day int) (responseCode int, action lib.EPPAction, err error)

SyncDomain is used to send a sync message to the reigstry to align a domain's expiration date to a specific day and month.

Jump to

Keyboard shortcuts

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