Documentation ¶
Index ¶
Constants ¶
View Source
const ( AMOUNT_VOUCHER_PARAM = "amount" CHANNEL_ID_VOUCHER_PARAM = "channelId" SIGNATURE_VOUCHER_PARAM = "signature" VOUCHER_CONTEXT_ARG contextKey = "voucher" ErrPayment = types.ConstError("payment error") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PaymentProxy ¶
type PaymentProxy struct {
// contains filtered or unexported fields
}
PaymentProxy is an HTTP proxy that charges for HTTP requests.
func NewPaymentProxy ¶
func NewPaymentProxy(proxyAddress string, nitroEndpoint string, destinationURL string, costPerByte uint64, certFilePath, certKeyPath string) *PaymentProxy
NewPaymentProxy creates a new PaymentProxy.
func (*PaymentProxy) ServeHTTP ¶
func (p *PaymentProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP is the main entry point for the payment proxy server. It is responsible for parsing the voucher from the query params and moving it to the request header It then delegates to the reverse proxy to handle rewriting the request and sending it to the destination
func (*PaymentProxy) Start ¶
func (p *PaymentProxy) Start() error
Start starts the proxy server in a goroutine.
func (*PaymentProxy) Stop ¶
func (p *PaymentProxy) Stop() error
Stop stops the proxy server and closes everything.
Click to show internal directories.
Click to hide internal directories.