msg

package
v0.0.0-...-9190965 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package msg contains simple types to assist with transmitting and communicating across a network about a payment channel between two participants. It is rather rudimentary and intended for use in examples. There are no stability or compatibility guarantees for the messages or encoding format used.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder = gob.Decoder

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

type Encoder

type Encoder = gob.Encoder

Encoder is an encoder that can be used to encode messages. It is currently set as the encoding/gob.Encoder, but may be changed to another type at anytime to facilitate testing or to improve performance.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

type Hello

type Hello struct {
	ChannelAccount keypair.FromAddress
	Signer         keypair.FromAddress
}

Hello can be used to signal to another participant a minimal amount of information the other participant needs to know about them.

type Message

type Message struct {
	Type Type

	Hello *Hello

	OpenRequest  *state.OpenEnvelope
	OpenResponse *state.OpenSignatures

	PaymentRequest  *state.CloseEnvelope
	PaymentResponse *state.CloseSignatures

	CloseRequest  *state.CloseEnvelope
	CloseResponse *state.CloseSignatures
}

Message is a message that can be transmitted to support two participants in a payment channel communicating by signaling who they are with a hello, opening the channel, making payments, and closing the channel.

type Type

type Type int

Type is the message type, used to indicate which message is contained inside a Message.

const (
	TypeHello           Type = 10
	TypeOpenRequest     Type = 20
	TypeOpenResponse    Type = 21
	TypePaymentRequest  Type = 30
	TypePaymentResponse Type = 31
	TypeCloseRequest    Type = 40
	TypeCloseResponse   Type = 41
)

Jump to

Keyboard shortcuts

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