Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeReceipt ¶
Types ¶
type NCSClient ¶
type NCSClient struct {
Endpoint string
Transport http.RoundTripper
}
NCSClient is the Network Credit Service client.
func NewNCSClient ¶
func NewNCSClient(endpoint string, transport http.RoundTripper) NCSClient
NewNCSClient returns a new NCS client with the NCS endpoint and a HTTP roundtripper.
func (*NCSClient) PostReceipt ¶
func (c *NCSClient) PostReceipt(ctx context.Context, payload ReceiptPayload) error
PostReceipt sends receipts to Network Credit Service /receipt endpoint.
type Receipt ¶
type Receipt struct {
AppID string `json:"app_id"`
ClientID string `json:"client_id"`
SessionID string `json:"session_id"`
HagallWalletAddr string `json:"hagall_wallet_addr"`
ParticipantID int `json:"participant_id"`
CreatedAt time.Time `json:"created_at"`
SessionJoinedAt time.Time `json:"session_joined_at"`
BytesSent int64 `json:"bytes_sent"`
BytesReceived int64 `json:"bytes_received"`
}
func DecodeReceipt ¶
type ReceiptPayload ¶
type ReceiptPayload struct {
Receipt string `json:"receipt"`
Hash []byte `json:"hash"`
Signature []byte `json:"signature"`
}
func NewReceiptPayload ¶
func NewReceiptPayload(receipt Receipt, privateKeyString string) (ReceiptPayload, error)
NewReceiptPayload returns a receipt payload signed with privateKeyString.
func NewReceiptPayloadFromParams ¶
func NewReceiptPayloadFromParams(receipt string, hash []byte, signature []byte) ReceiptPayload
Click to show internal directories.
Click to hide internal directories.