transport_interface

package
v0.0.0-...-a53bfeb Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CryptoTypeECDSA = CryptoType(cryptopb.KeyType_ECDSA)
View Source
const CryptoTypeEd25519 = CryptoType(cryptopb.KeyType_Ed25519)
View Source
const CryptoTypeRSA = CryptoType(cryptopb.KeyType_RSA)
View Source
const CryptoTypeSecp256k1 = CryptoType(cryptopb.KeyType_Secp256k1)

Variables

This section is empty.

Functions

func LoadKnownPeers

func LoadKnownPeers(path string) (peers []string, err error)

func PrettyId

func PrettyId(peerId string) string

func PrettyIds

func PrettyIds(peerId []string) string

Types

type Bytable

type Bytable interface {
	ToBytes() []byte
	FromBytes(bts []byte) error
}

type CryptoType

type CryptoType int

type IncomingLetter

type IncomingLetter struct {
	Msg  *WireMessage
	From string // peer Id
}

func (IncomingLetter) String

func (i IncomingLetter) String() string

type NewIncomingMessageEventSubscriber

type NewIncomingMessageEventSubscriber interface {
	Name() string
	NewIncomingMessageEventChannel() chan *IncomingLetter
}

type NewOutgoingMessageEventSubscriber

type NewOutgoingMessageEventSubscriber interface {
	Name() string
	NewOutgoingMessageEventChannel() chan *OutgoingLetter
}

type OutgoingLetter

type OutgoingLetter struct {
	Msg            OutgoingMsg
	SendType       SendType
	CloseAfterSent bool
	ExceptMyself   bool
	EndReceivers   []string // may be the relayer
}

func (OutgoingLetter) String

func (o OutgoingLetter) String() string

type OutgoingMsg

type OutgoingMsg interface {
	Bytable
	msgp.Marshaler
	msgp.Unmarshaler
	GetTypeValue() int
	String() string
}

type PeerConnectedEventSubscriber

type PeerConnectedEventSubscriber interface {
	Name() string
	GetPeerConnectedEventChannel() chan *PeerEvent
}

type PeerDisconnectedEventSubscriber

type PeerDisconnectedEventSubscriber interface {
	Name() string
	GetPeerDisconnectedEventChannel() chan *PeerEvent
}

type PeerEvent

type PeerEvent struct {
	PeerId string
}

type RelayableOutgoingMsg

type RelayableOutgoingMsg interface {
	OutgoingMsg
	GetReceiverId() string // final receiver.
	GetOriginId() string   // original sender
}

type SendType

type SendType int
const (
	SendTypeUnicast   SendType = iota // send to only one
	SendTypeMulticast                 // send to multiple receivers
	SendTypeBroadcast                 // send to all peers in the network
)

func (SendType) String

func (s SendType) String() string

type TransportAccount

type TransportAccount struct {
	PublicKey  crypto.PubKey
	PrivateKey crypto.PrivKey
	NodeId     string
}

TransportAccount represents a full account of a user in p2p network.

type WireMessage

type WireMessage struct {
	MsgType      int    // what ContentByte is.
	ContentBytes []byte // this Byte will be recovered to implementation of Content interface
}

WireMessage is for transportation. msgp WireMessage

func (*WireMessage) DecodeMsg

func (z *WireMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*WireMessage) EncodeMsg

func (z *WireMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*WireMessage) MarshalMsg

func (z *WireMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*WireMessage) Msgsize

func (z *WireMessage) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*WireMessage) UnmarshalMsg

func (z *WireMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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