server

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoContactFound    = errors.New("no contact found")
	ErrNoHostFound       = errors.New("no host found")
	ErrNoDomainFound     = errors.New("no domain found")
	ErrClientTimeout     = errors.New("client timeout")
	ErrNotImplemented    = errors.New("not implemented")
	ErrUnhandledTransfer = errors.New("unhandled transfer")
)

Functions

func WaitDuration

func WaitDuration(notify chan bool, delay time.Duration)

WaitDuration sleeps for a delay time and then sends a true to the channel provided.

Types

type EPPServer

type EPPServer struct {
	Host    string
	Port    int
	Timeout time.Duration

	KillChan   chan bool
	KilledChan chan bool

	Running chan bool

	Logins                 map[string]LoginObject
	MaxFailedLoginAttempts int

	NextConnectionID int

	Contacts map[string]lib.Contact
	Hosts    map[string]lib.Host
	Domains  map[string]lib.Domain

	Log *logging.Logger
	// contains filtered or unexported fields
}

EPPServer contains the infomration required to run a testing EPP server.

func NewEPPServer

func NewEPPServer(host string, port int, timeout time.Duration) EPPServer

NewEPPServer will take the vital information related to the server like the host address, port and connection timeout duration that it should use for communicating with clients.

func (EPPServer) ContactByID

func (srv EPPServer) ContactByID(id string) (*lib.Contact, error)

ContactByID searches for contacts by the RegistryID.

func (EPPServer) DomainByName

func (srv EPPServer) DomainByName(name string) (*lib.Domain, error)

DomainByName searches for domain by the DomainName.

func (EPPServer) HostByName

func (srv EPPServer) HostByName(name string) (*lib.Host, error)

HostByName searches for hosts by the HostName.

func (*EPPServer) Start

func (srv *EPPServer) Start() error

Start will initiate the server and block until the server is killed or an error occurs while stariting up or running.

type EPPServerConnection

type EPPServerConnection struct {
	Conn        net.Conn
	Conf        *EPPServer
	RecvChannel chan epp.Epp

	FailedLoginAttempts int

	TXID         int
	ConnectionID int

	LoggedIn *LoginObject

	Log *logging.Logger
}

EPPServerConnection has the required information to handle communication with an epp client.

func (*EPPServerConnection) Close

func (conn *EPPServerConnection) Close() error

Close will close the underlying connection with the client.

func (*EPPServerConnection) CloseConnection

func (conn *EPPServerConnection) CloseConnection(err error) error

CloseConnection closes the socket associated with the connection.

func (*EPPServerConnection) GetNextTransactionID

func (conn *EPPServerConnection) GetNextTransactionID() string

GetNextTransactionID generates a new Transaction ID for the server's commuication.

func (*EPPServerConnection) Handle

func (conn *EPPServerConnection) Handle() error

Handle accepts a new connection and communications with the client.

func (*EPPServerConnection) HandleWaitingForClient

func (conn *EPPServerConnection) HandleWaitingForClient(timeout chan bool) (state EPPServerState, err error)

HandleWaitingForClient handles the Waiting for client state of the EPP Server Connection.

func (*EPPServerConnection) HandleWaitingForCommand

func (conn *EPPServerConnection) HandleWaitingForCommand(timeout chan bool) (state EPPServerState, err error)

HandleWaitingForCommand handles the waiting for command sate of the EPP server connection.

func (*EPPServerConnection) Listen

func (conn *EPPServerConnection) Listen() error

Listen will try to receive messages from the socket associated with a connection.

func (*EPPServerConnection) Write

func (conn *EPPServerConnection) Write(b []byte) (n int, err error)

Write will accept a series of bytes and return the number of bytes written and an error from the underlying socket.

func (*EPPServerConnection) WriteEPP

func (conn *EPPServerConnection) WriteEPP(msg epp.Epp) error

WriteEPP takes an epp object and serializes it onto the socket for the connection.

type EPPServerState

type EPPServerState string

EPPServerState is a type that is used to represent the current state of the EPP server according to the http://tools.ietf.org/html/rfc5730.

var (
	// EPPServerPrepareGreeting represents the "Prepare Greeting" state of
	// RFC5730.
	EPPServerPrepareGreeting EPPServerState = "PrepareGreeting"

	// EPPServerWaitingForClient represents the "Waiting For Client
	// Authentication" state of RFC5730.
	EPPServerWaitingForClient EPPServerState = "WaitingForClient"

	// EPPServerWaitingForCommand represents the "Waiting For Command
	// or hello" state of RFC5730.
	EPPServerWaitingForCommand EPPServerState = "WaitingForCommand"

	// EPPServerCloseConnection represents the "End Session" state of
	// RFC5730.
	EPPServerCloseConnection EPPServerState = "CloseConnection"
)

type LoginObject

type LoginObject struct {
	LoginID     string
	Password    string
	RegistrarID string
}

LoginObject is used to hold the information about a specific Login in to the epp server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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