epp

package module
v0.0.0-...-7ffee0d Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 14 Imported by: 0

README

EPP for Go

build status pkg.go.dev

Extensible Provisioning Protocol (EPP) for Go.

EPP is an XML-based protocol for provisioning and managing domain names and other objects at domain name registries. The underlying transport is usually TLS, secured with password authentication, IP allow lists, and mTLS.

Note: This is a fork of domainr/epp to develop and test the next version of its API. You should probably use it instead.

Author

© Domain Research, LLC

Documentation

Index

Constants

View Source
const ErrClosedConnection stringError = "operation on closed connection"

ErrClosedConnection indicates a read or write operation on a closed connection.

View Source
const ErrServerClosed stringError = "server closed"

ErrServerClosed indicates a [Server] has shut down or closed.

Variables

This section is empty.

Functions

func Command

func Command(cfg *Config, action epp.Action, extensions ...epp.Extension) (epp.Body, error)

func ErrorResponse

func ErrorResponse(cfg *Config, err error) epp.Body

func Greeting

func Greeting(cfg *Config) (epp.Body, error)

func Login

func Login(cfg *Config, clientID, password string, newPassword *string) (epp.Body, error)

func Logout

func Logout(cfg *Config) (epp.Body, error)

Types

type Client

type Client interface {
	// Login(username, password, newPassword string) error
	// Logout() error
	Close() error
}

func Connect

func Connect(conn net.Conn, opts ...Options) (Client, error)

func Dial

func Dial(network, addr string, opts ...Options) (Client, error)

type Config

type Config struct {
	// Supported EPP version(s). Typically this should not be set by either
	// a client or server. If nil, this will default to []string{"1.0"}
	// (currently the only supported version).
	Versions []string

	// BCP 47 language code(s) for human-readable messages. For clients,
	// this describes the desired language(s) in preferred order. If the
	// server does not support any of the client’s preferred languages, the
	// first language advertised by the server will be selected. For
	// servers, this describes its supported language(s). If nil,
	// []string{"en"} will be used.
	Languages []string

	// Objects is a list of XML namespace URIs enumerating the EPP objects
	// supported by the client or server.
	//
	// For clients, this describes the object type(s) the client wants to
	// access.
	//
	// For servers, this describes the object type(s) the server allows
	// clients to access.
	//
	// If nil, a reasonable set of defaults will be used.
	Objects []string

	// Extensions is a list of XML namespace URIs enumerating the EPP
	// extensions supported by the client or server.
	//
	// For clients, this is a list of extensions(s) the client wants to use
	// in preferred order. If nil, a client will use its preferred version
	// of each supported extension announced by the server.
	//
	// For servers, this is list of announced extension(s).
	//
	// If nil, no EPP extensions will be used.
	Extensions []string

	// UnannouncedExtensions contains one or more EPP extensions to be used even if
	// the peer does not announce support for it. This is used as a
	// workaround for EPP servers that incorrectly announce the extensions
	// they support.
	//
	// This value should typically be left nil. This will always be nil when
	// read from a peer.
	UnannouncedExtensions []string

	// Schemas contains the list of [schema.Schema] that maps object and extension
	// namespaces to Go types.
	//
	// If nil or empty, reasonable defaults will be used.
	Schemas []schema.Schema

	// TransactionID, if not nil, returns unique values used for client or
	// server transaction IDs. For clients, this generates command
	// transaction IDs. For servers, this generates response transaction
	// IDs.
	//
	// The function must be safe to call from multiple goroutines.
	//
	// If nil, a sequential transaction ID with a random prefix will be
	// used.
	TransactionID func() string
}

Config describes the configuration of an EPP client or server, including EPP objects and extensions used for a connection.

func ConfigForGreeting

func ConfigForGreeting(cfg *Config, greeting *epp.Greeting) (*Config, error)

ConfigForGreeting returns a client-centric Config sharing the mutual capabilities announced in an epp.Greeting. If the Config or Greeting do not share a mutual set of EPP versions, languages, and objects, it will return an error. The resulting Config is suitable for creating EPP elements transmittable to the server that sent the Greeting.

TODO: implement this function.

func ConfigForLogin

func ConfigForLogin(cfg *Config, login *epp.Login) (*Config, error)

ConfigForLogin returns a server-centric Config sharing the mutual capabilities announced in an epp.Login. If the Config or Login do not share a mutual set of EPP versions, languages, and objects, it will return an error. The resulting Config is suitable for creating EPP elements transmittable to the client that generated the Login.

The error returned may be an *epp.Result which can be transmitted back to an EPP client in an epp.Response.

TODO: implement this function.

func (Config) Copy

func (c Config) Copy() Config

Copy deep copy of c.

type ContextDialer

type ContextDialer = config.ContextDialer

ContextDialer is any type with a DialContext method that returns (net.Conn, [error]).

type DuplicateTransactionIDError

type DuplicateTransactionIDError TransactionIDError

DuplicateTransactionIDError indicates a duplicate transaction ID.

func (DuplicateTransactionIDError) Error

func (err DuplicateTransactionIDError) Error() string

Error implements the error interface.

type Error

type Error interface {
	// contains filtered or unexported methods
}

Error is the interface implemented by all errors in this package.

type Options

type Options = config.Options

Options configure [TODO] with specific features.

func WithContext

func WithContext(ctx context.Context) Options

func WithDialer

func WithDialer(d ContextDialer) Options

func WithKeepAlive

func WithKeepAlive(d time.Duration) Options

func WithPipeline

func WithPipeline(depth int) Options

func WithSchema

func WithSchema(schemas ...schema.Schema) Options

func WithTLS

func WithTLS(cfg *tls.Config) Options

func WithTimeout

func WithTimeout(d time.Duration) Options

type Session

type Session interface {
	// Context returns the connection Context for this session. The Context
	// will be canceled if the underlying connection goes away or is closed.
	Context() context.Context

	// ReadCommand reads the next EPP command from the client. An error will
	// be returned if the underlying connection is closed or an error occurs
	// reading from the connection.
	ReadCommand() (*epp.Command, error)

	// WriteResponse sends an EPP response to the client. An error will
	// be returned if the underlying connection is closed or an error occurs
	// writing to the connection.
	WriteResponse(*epp.Response) error

	// Close closes the session and the underlying connection.
	Close() error
}

type TransactionIDError

type TransactionIDError struct {
	TransactionID string
}

TransactionIDError indicates an invalid transaction ID.

func (TransactionIDError) Error

func (err TransactionIDError) Error() string

Error implements the error interface.

Directories

Path Synopsis
xml
dataunit
Package dataunit implements low-level encoding of the EPP data unit protocol.
Package dataunit implements low-level encoding of the EPP data unit protocol.
epp
std

Jump to

Keyboard shortcuts

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