rpc

package
v0.0.0-...-fe3043a Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2015 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AmqpExchange     = "boulder"
	AmqpExchangeType = "topic"
	AmqpInternal     = false
	AmqpDurable      = false
	AmqpDeleteUnused = false
	AmqpExclusive    = false
	AmqpNoWait       = false
	AmqpNoLocal      = false
	AmqpAutoAck      = true
	AmqpMandatory    = false
	AmqpImmediate    = false
)

XXX: I *think* these constants are appropriate. We will probably want to tweak these in the future.

View Source
const (
	MethodNewRegistration             = "NewRegistration"             // RA, SA
	MethodNewAuthorization            = "NewAuthorization"            // RA
	MethodNewCertificate              = "NewCertificate"              // RA
	MethodUpdateRegistration          = "UpdateRegistration"          // RA, SA
	MethodUpdateAuthorization         = "UpdateAuthorization"         // RA
	MethodRevokeCertificate           = "RevokeCertificate"           // RA, CA
	MethodOnValidationUpdate          = "OnValidationUpdate"          // RA
	MethodUpdateValidations           = "UpdateValidations"           // VA
	MethodCheckCAARecords             = "CheckCAARecords"             // VA
	MethodIssueCertificate            = "IssueCertificate"            // CA
	MethodGenerateOCSP                = "GenerateOCSP"                // CA
	MethodGetRegistration             = "GetRegistration"             // SA
	MethodGetRegistrationByKey        = "GetRegistrationByKey"        // RA, SA
	MethodGetAuthorization            = "GetAuthorization"            // SA
	MethodGetLatestValidAuthorization = "GetLatestValidAuthorization" // SA
	MethodGetCertificate              = "GetCertificate"              // SA
	MethodGetCertificateByShortSerial = "GetCertificateByShortSerial" // SA
	MethodGetCertificateStatus        = "GetCertificateStatus"        // SA
	MethodMarkCertificateRevoked      = "MarkCertificateRevoked"      // SA
	MethodUpdateOCSP                  = "UpdateOCSP"                  // SA
	MethodNewPendingAuthorization     = "NewPendingAuthorization"     // SA
	MethodUpdatePendingAuthorization  = "UpdatePendingAuthorization"  // SA
	MethodFinalizeAuthorization       = "FinalizeAuthorization"       // SA
	MethodAddCertificate              = "AddCertificate"              // SA
	MethodAlreadyDeniedCSR            = "AlreadyDeniedCSR"            // SA
)

These strings are used by the RPC layer to identify function points.

Variables

This section is empty.

Functions

func AMQPDeclareExchange

func AMQPDeclareExchange(conn *amqp.Connection) error

AMQPDeclareExchange attempts to declare the configured AMQP exchange, returning silently if already declared, erroring if nonexistant and unable to create.

func AmqpChannel

func AmqpChannel(conf cmd.Config) (*amqp.Channel, error)

AmqpChannel sets a AMQP connection up using SSL if configuration is provided

func NewCertificateAuthorityServer

func NewCertificateAuthorityServer(rpc RPCServer, impl core.CertificateAuthority) (err error)

NewCertificateAuthorityServer constructs an RPC server

CertificateAuthorityClient / Server

-> IssueCertificate

func NewRegistrationAuthorityServer

func NewRegistrationAuthorityServer(rpc RPCServer, impl core.RegistrationAuthority) error

NewRegistrationAuthorityServer constructs an RPC server

func NewStorageAuthorityServer

func NewStorageAuthorityServer(rpc RPCServer, impl core.StorageAuthority) error

NewStorageAuthorityServer constructs an RPC server

func NewValidationAuthorityServer

func NewValidationAuthorityServer(rpc RPCServer, impl core.ValidationAuthority) (err error)

NewValidationAuthorityServer constructs an RPC server

ValidationAuthorityClient / Server

-> UpdateValidations

Types

type AmqpRPCCLient

type AmqpRPCCLient struct {
	// contains filtered or unexported fields
}

AmqpRPCCLient is an AMQP-RPC client that sends requests to a specific server queue, and uses a dedicated response queue for responses.

To implement specific functionality, using code uses the Dispatch() method to send a method name and body, and get back a response. So you end up with wrapper methods of the form:

```

request = /* serialize request to []byte */
response = <-AmqpRPCCLient.Dispatch(method, request)
return /* deserialized response */

```

Callers that don't care about the response can just call Dispatch() and ignore the return value.

DispatchSync will manage the channel for you, and also enforce a timeout on the transaction (default 60 seconds)

func NewAmqpRPCClient

func NewAmqpRPCClient(clientQueuePrefix, serverQueue string, channel *amqp.Channel) (rpc *AmqpRPCCLient, err error)

NewAmqpRPCClient constructs an RPC client using AMQP

func (*AmqpRPCCLient) Dispatch

func (rpc *AmqpRPCCLient) Dispatch(method string, body []byte) chan []byte

Dispatch sends a body to the destination, and returns a response channel that can be used to monitor for responses, or discarded for one-shot actions.

func (*AmqpRPCCLient) DispatchSync

func (rpc *AmqpRPCCLient) DispatchSync(method string, body []byte) (response []byte, err error)

DispatchSync sends a body to the destination, and blocks waiting on a response.

func (*AmqpRPCCLient) SetTimeout

func (rpc *AmqpRPCCLient) SetTimeout(ttl time.Duration)

SetTimeout configures the maximum time DispatchSync will wait for a response before returning an error.

type AmqpRPCServer

type AmqpRPCServer struct {
	Channel *amqp.Channel
	// contains filtered or unexported fields
}

AmqpRPCServer listens on a specified queue within an AMQP channel. When messages arrive on that queue, it dispatches them based on type, and returns the response to the ReplyTo queue.

To implement specific functionality, using code should use the Handle method to add specific actions.

func NewAmqpRPCServer

func NewAmqpRPCServer(serverQueue string, handler func(*AmqpRPCServer)) (*AmqpRPCServer, error)

NewAmqpRPCServer creates a new RPC server for the given queue and will begin consuming requests from the queue. To start the server you must call Start().

func (*AmqpRPCServer) Handle

func (rpc *AmqpRPCServer) Handle(method string, handler func([]byte) ([]byte, error))

Handle registers a function to handle a particular method.

func (*AmqpRPCServer) Start

func (rpc *AmqpRPCServer) Start(c cmd.Config) error

Start starts the AMQP-RPC server and handles reconnections, this will block until a fatal error is returned or AmqpRPCServer.Stop() is called and all remaining messages are processed.

func (*AmqpRPCServer) Stop

func (rpc *AmqpRPCServer) Stop()

Stop gracefully stops the AmqpRPCServer, after calling AmqpRPCServer.Start will continue blocking until it has processed any messages that have already been retrieved.

type CertificateAuthorityClient

type CertificateAuthorityClient struct {
	// contains filtered or unexported fields
}

CertificateAuthorityClient is a client to communicate with the CA.

func NewCertificateAuthorityClient

func NewCertificateAuthorityClient(client RPCClient) (cac CertificateAuthorityClient, err error)

NewCertificateAuthorityClient constructs an RPC client

func (CertificateAuthorityClient) GenerateOCSP

func (cac CertificateAuthorityClient) GenerateOCSP(signRequest core.OCSPSigningRequest) (resp []byte, err error)

GenerateOCSP sends a request to generate an OCSP response

func (CertificateAuthorityClient) IssueCertificate

func (cac CertificateAuthorityClient) IssueCertificate(csr x509.CertificateRequest, regID int64, earliestExpiry time.Time) (cert core.Certificate, err error)

IssueCertificate sends a request to issue a certificate

func (CertificateAuthorityClient) RevokeCertificate

func (cac CertificateAuthorityClient) RevokeCertificate(serial string, reasonCode int) (err error)

RevokeCertificate sends a request to revoke a certificate

type RPCClient

type RPCClient interface {
	SetTimeout(time.Duration)
	Dispatch(string, []byte) chan []byte
	DispatchSync(string, []byte) ([]byte, error)
}

RPCClient describes the functions an RPC Client performs

type RPCError

type RPCError struct {
	Value string `json:"value"`
	Type  string `json:"type,omitempty"`
}

RPCError is a JSON wrapper for error as it cannot be un/marshalled due to type interface{}.

type RPCResponse

type RPCResponse struct {
	ReturnVal []byte   `json:"returnVal,omitempty"`
	Error     RPCError `json:"error,omitempty"`
}

RPCResponse is a stuct for wire-representation of response messages used by DispatchSync

type RPCServer

type RPCServer interface {
	Handle(string, func([]byte) ([]byte, error))
}

RPCServer describes the functions an RPC Server performs

type RegistrationAuthorityClient

type RegistrationAuthorityClient struct {
	// contains filtered or unexported fields
}

RegistrationAuthorityClient represents an RA RPC client

func NewRegistrationAuthorityClient

func NewRegistrationAuthorityClient(client RPCClient) (rac RegistrationAuthorityClient, err error)

NewRegistrationAuthorityClient constructs an RPC client

func (RegistrationAuthorityClient) NewAuthorization

func (rac RegistrationAuthorityClient) NewAuthorization(authz core.Authorization, regID int64) (newAuthz core.Authorization, err error)

NewAuthorization sends a New Authorization request

func (RegistrationAuthorityClient) NewCertificate

func (rac RegistrationAuthorityClient) NewCertificate(cr core.CertificateRequest, regID int64) (cert core.Certificate, err error)

NewCertificate sends a New Certificate request

func (RegistrationAuthorityClient) NewRegistration

func (rac RegistrationAuthorityClient) NewRegistration(reg core.Registration) (newReg core.Registration, err error)

NewRegistration sends a New Registration request

func (RegistrationAuthorityClient) OnValidationUpdate

func (rac RegistrationAuthorityClient) OnValidationUpdate(authz core.Authorization) (err error)

OnValidationUpdate senda a notice that a validation has updated

func (RegistrationAuthorityClient) RevokeCertificate

func (rac RegistrationAuthorityClient) RevokeCertificate(cert x509.Certificate) (err error)

RevokeCertificate sends a Revoke Certificate request

func (RegistrationAuthorityClient) UpdateAuthorization

func (rac RegistrationAuthorityClient) UpdateAuthorization(authz core.Authorization, index int, response core.Challenge) (newAuthz core.Authorization, err error)

UpdateAuthorization sends an Update Authorization request

func (RegistrationAuthorityClient) UpdateRegistration

func (rac RegistrationAuthorityClient) UpdateRegistration(base core.Registration, update core.Registration) (newReg core.Registration, err error)

UpdateRegistration sends an Update Registration request

type StorageAuthorityClient

type StorageAuthorityClient struct {
	// contains filtered or unexported fields
}

StorageAuthorityClient is a client to communicate with the Storage Authority

func NewStorageAuthorityClient

func NewStorageAuthorityClient(client RPCClient) (sac StorageAuthorityClient, err error)

NewStorageAuthorityClient constructs an RPC client

func (StorageAuthorityClient) AddCertificate

func (cac StorageAuthorityClient) AddCertificate(cert []byte, regID int64) (id string, err error)

AddCertificate sends a request to record the issuance of a certificate

func (StorageAuthorityClient) AlreadyDeniedCSR

func (cac StorageAuthorityClient) AlreadyDeniedCSR(names []string) (exists bool, err error)

AlreadyDeniedCSR sends a request to search for denied names

func (StorageAuthorityClient) FinalizeAuthorization

func (cac StorageAuthorityClient) FinalizeAuthorization(authz core.Authorization) (err error)

FinalizeAuthorization sends a request to finalize an authorization (convert from pending)

func (StorageAuthorityClient) GetAuthorization

func (cac StorageAuthorityClient) GetAuthorization(id string) (authz core.Authorization, err error)

GetAuthorization sends a request to get an Authorization by ID

func (StorageAuthorityClient) GetCertificate

func (cac StorageAuthorityClient) GetCertificate(id string) (cert core.Certificate, err error)

GetCertificate sends a request to get a Certificate by ID

func (StorageAuthorityClient) GetCertificateByShortSerial

func (cac StorageAuthorityClient) GetCertificateByShortSerial(id string) (cert core.Certificate, err error)

GetCertificateByShortSerial sends a request to search for a certificate by the predictable portion of its serial number.

func (StorageAuthorityClient) GetCertificateStatus

func (cac StorageAuthorityClient) GetCertificateStatus(id string) (status core.CertificateStatus, err error)

GetCertificateStatus sends a request to obtain the current status of a certificate by ID

func (StorageAuthorityClient) GetLatestValidAuthorization

func (cac StorageAuthorityClient) GetLatestValidAuthorization(registrationId int64, identifier core.AcmeIdentifier) (authz core.Authorization, err error)

GetLatestValidAuthorization sends a request to get an Authorization by RegID, Identifier

func (StorageAuthorityClient) GetRegistration

func (cac StorageAuthorityClient) GetRegistration(id int64) (reg core.Registration, err error)

GetRegistration sends a request to get a registration by ID

func (StorageAuthorityClient) GetRegistrationByKey

func (cac StorageAuthorityClient) GetRegistrationByKey(key jose.JsonWebKey) (reg core.Registration, err error)

GetRegistrationByKey sends a request to get a registration by JWK

func (StorageAuthorityClient) MarkCertificateRevoked

func (cac StorageAuthorityClient) MarkCertificateRevoked(serial string, ocspResponse []byte, reasonCode int) (err error)

MarkCertificateRevoked sends a request to mark a certificate as revoked

func (StorageAuthorityClient) NewPendingAuthorization

func (cac StorageAuthorityClient) NewPendingAuthorization(authz core.Authorization) (output core.Authorization, err error)

NewPendingAuthorization sends a request to store a pending authorization

func (StorageAuthorityClient) NewRegistration

func (cac StorageAuthorityClient) NewRegistration(reg core.Registration) (output core.Registration, err error)

NewRegistration sends a request to store a new registration

func (StorageAuthorityClient) UpdateOCSP

func (cac StorageAuthorityClient) UpdateOCSP(serial string, ocspResponse []byte) (err error)

UpdateOCSP sends a request to store an updated OCSP response

func (StorageAuthorityClient) UpdatePendingAuthorization

func (cac StorageAuthorityClient) UpdatePendingAuthorization(authz core.Authorization) (err error)

UpdatePendingAuthorization sends a request to update the data in a pending authorization

func (StorageAuthorityClient) UpdateRegistration

func (cac StorageAuthorityClient) UpdateRegistration(reg core.Registration) (err error)

UpdateRegistration sends a request to store an updated registration

type ValidationAuthorityClient

type ValidationAuthorityClient struct {
	// contains filtered or unexported fields
}

ValidationAuthorityClient represents an RPC client for the VA

func NewValidationAuthorityClient

func NewValidationAuthorityClient(client RPCClient) (vac ValidationAuthorityClient, err error)

NewValidationAuthorityClient constructs an RPC client

func (ValidationAuthorityClient) CheckCAARecords

func (vac ValidationAuthorityClient) CheckCAARecords(ident core.AcmeIdentifier) (present bool, valid bool, err error)

CheckCAARecords sends a request to check CAA records

func (ValidationAuthorityClient) UpdateValidations

func (vac ValidationAuthorityClient) UpdateValidations(authz core.Authorization, index int, key jose.JsonWebKey) error

UpdateValidations sends an Update Validations request

Jump to

Keyboard shortcuts

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