process

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
const UrlParameterBlockNonce = "blockNonce"

UrlParameterBlockNonce represents the name of a URL parameter

View Source
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

func NewDemuxer(handlers map[string]http.Handler, rootHandler http.Handler) *demuxer

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

func NewHttpRequester(timeout time.Duration) *httpRequester

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

type ArgsSmtpSender struct {
	SmtpPort int
	SmtpHost string
	From     string
	Password string
}

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

type PerformanceMonitor interface {
	AddPerformanceMetricAsync(label string)
	IsInterfaceNil() bool
}

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

Jump to

Keyboard shortcuts

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