Documentation
¶
Index ¶
- Constants
- func NewAccessChecker(keyAccessProvider KeyAccessProvider, counter KeyCounter, ...) (*accessChecker, error)
- func NewCaptchaWrapper() *captchaWrapper
- func NewDemuxer(handlers map[string]http.Handler, rootHandler http.Handler) *demuxer
- func NewHostsFinder(configGateways []config.GatewayConfig) (*hostsFinder, error)
- func NewHttpRequester(timeout time.Duration) *httpRequester
- func NewRequestsProcessor(hostFinder HostFinder, accessChecker AccessChecker, ...) (*requestsProcessor, error)
- func NewRequestsSynchronizer(store UsersSyncerStore, cryptoClient CryptoDataFetcher) (*requestsSynchronizer, error)
- func NewSmtpSender(args ArgsSmtpSender) *smtpSender
- func NewUserMutexManager() *userMutexManager
- func RespondWithError(writer http.ResponseWriter, err error, statusCode int)
- type AccessChecker
- type ArgsSmtpSender
- type CryptoDataFetcher
- type GenericAPIResponse
- type HostFinder
- type KeyAccessProvider
- type KeyCounter
- type PerformanceMonitor
- type ReturnCode
- type UsersSyncerStore
Constants ¶
const BasicHTMLTemplate = `<!-- template.html -->
<!DOCTYPE html>
<html lang="en">
<body>
{{.Body}}
</body>
</html>
`
BasicHTMLTemplate is a template for a basic email message. Can be used in testing
const UrlParameterBlockNonce = "blockNonce"
UrlParameterBlockNonce represents the name of a URL parameter
const UrlParameterHintEpoch = "hintEpoch"
UrlParameterHintEpoch represents the name of a URL parameter
Variables ¶
This section is empty.
Functions ¶
func NewAccessChecker ¶
func NewAccessChecker( keyAccessProvider KeyAccessProvider, counter KeyCounter, maxNumCallsForFreeAccount uint64, ) (*accessChecker, error)
NewAccessChecker creates a new instance of type access checker
func NewCaptchaWrapper ¶
func NewCaptchaWrapper() *captchaWrapper
NewCaptchaWrapper creates a new captcha wrapper
func NewDemuxer ¶
NewDemuxer can create a demuxer able to call different http handlers based on the request.RequestURI. the default handler should be registered with the * key
func NewHostsFinder ¶
func NewHostsFinder(configGateways []config.GatewayConfig) (*hostsFinder, error)
NewHostsFinder will create a new hosts finder instance
func NewHttpRequester ¶
NewHttpRequester creates a new instance of httpRequester
func NewRequestsProcessor ¶
func NewRequestsProcessor( hostFinder HostFinder, accessChecker AccessChecker, performanceMonitor PerformanceMonitor, closedEndpoints []string, ) (*requestsProcessor, error)
NewRequestsProcessor creates a new requests processor
func NewRequestsSynchronizer ¶
func NewRequestsSynchronizer( store UsersSyncerStore, cryptoClient CryptoDataFetcher, ) (*requestsSynchronizer, error)
NewRequestsSynchronizer creates a new instance of requestsSynchronizer
func NewSmtpSender ¶
func NewSmtpSender(args ArgsSmtpSender) *smtpSender
NewSmtpSender creates a new SMTP email sender
func NewUserMutexManager ¶
func NewUserMutexManager() *userMutexManager
NewUserMutexManager creates a new UserMutexManager
func RespondWithError ¶
func RespondWithError(writer http.ResponseWriter, err error, statusCode int)
RespondWithError should be called when the request cannot be satisfied due to an internal error
Types ¶
type AccessChecker ¶
type AccessChecker interface {
ShouldProcessRequest(header http.Header, requestURI string) (string, error)
IsInterfaceNil() bool
}
AccessChecker is able to check if the request should be processed or not
type ArgsSmtpSender ¶
ArgsSmtpSender represents the SMTP sender arguments used in the constructor function
type CryptoDataFetcher ¶
type CryptoDataFetcher interface {
GetAccount(paymentID uint64) (*common.AccountInfo, error)
IsInterfaceNil() bool
}
CryptoDataFetcher handles communication with the crypto-payment service
type GenericAPIResponse ¶
type GenericAPIResponse struct {
Data interface{} `json:"data"`
Error string `json:"error"`
Code ReturnCode `json:"code"`
}
GenericAPIResponse defines the structure of all responses on API endpoints
type HostFinder ¶
type HostFinder interface {
FindHost(urlValues map[string][]string) (config.GatewayConfig, error)
LoadedGateways() []config.GatewayConfig
IsInterfaceNil() bool
}
HostFinder is able to return a valid host based on a search criteria
type KeyAccessProvider ¶
type KeyAccessProvider interface {
IsKeyAllowed(key string) (string, common.AccountType, error)
IsInterfaceNil() bool
}
KeyAccessProvider can decide if a provided key has or not query access
type KeyCounter ¶
type KeyCounter interface {
IncrementReturningCurrent(key string) uint64
Clear()
IsInterfaceNil() bool
}
KeyCounter is able to keep track of how many increments a particular key has
type PerformanceMonitor ¶
PerformanceMonitor is able to store performance metrics
type ReturnCode ¶
type ReturnCode string
ReturnCode defines the type defines to identify return codes
const ( // ReturnCodeRequestError defines a request which hasn't been executed successfully due to a bad request received ReturnCodeRequestError ReturnCode = "bad_request" )
type UsersSyncerStore ¶
type UsersSyncerStore interface {
GetAllUsers() (map[string]common.UsersDetails, error)
UpdateUserMaxRequestsFromContract(username string, contractMaxRequests uint64) error
IsInterfaceNil() bool
}
UsersSyncerStore defines the operations supported by the storage for synchronizing users