paymentproxy

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0, MIT Imports: 15 Imported by: 0

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.

Jump to

Keyboard shortcuts

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