Documentation ¶
Index ¶
- type AddrInfo
- func (v *AddrInfo) Copy() *AddrInfo
- func (v *AddrInfo) CopyAsInterface() interface{}
- func (v *AddrInfo) Equal(u *AddrInfo) bool
- func (v *AddrInfo) IsValid() error
- func (v *AddrInfo) MarshalBinary() ([]byte, error)
- func (v *AddrInfo) MarshalJSON() ([]byte, error)
- func (v *AddrInfo) UnmarshalBinary(data []byte) error
- func (v *AddrInfo) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *AddrInfo) UnmarshalJSON(data []byte) error
- type Info
- func (v *Info) Copy() *Info
- func (v *Info) CopyAsInterface() interface{}
- func (v *Info) Equal(u *Info) bool
- func (i *Info) HasService(service *api.ServiceAddress) bool
- func (v *Info) IsValid() error
- func (v *Info) MarshalBinary() ([]byte, error)
- func (v *Info) MarshalJSON() ([]byte, error)
- func (v *Info) UnmarshalBinary(data []byte) error
- func (v *Info) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *Info) UnmarshalJSON(data []byte) error
- type MessageStreamHandler
- type Node
- func (n *Node) Addrs() []multiaddr.Multiaddr
- func (n *Node) Close() error
- func (n *Node) ConnectDirectly(m *Node) error
- func (n *Node) Dialer() message.MultiDialer
- func (n *Node) ID() peer.ID
- func (n *Node) Peers() []*Info
- func (n *Node) RegisterService(sa *api.ServiceAddress, handler MessageStreamHandler) bool
- func (n *Node) SelfDialer() message.Dialer
- func (s *Node) WaitForService(sa *api.ServiceAddress)
- type Options
- type PartitionOptions
- type ServiceInfo
- func (v *ServiceInfo) Copy() *ServiceInfo
- func (v *ServiceInfo) CopyAsInterface() interface{}
- func (v *ServiceInfo) Equal(u *ServiceInfo) bool
- func (v *ServiceInfo) IsValid() error
- func (v *ServiceInfo) MarshalBinary() ([]byte, error)
- func (v *ServiceInfo) UnmarshalBinary(data []byte) error
- func (v *ServiceInfo) UnmarshalBinaryFrom(rd io.Reader) error
- type Whoami
- func (v *Whoami) Copy() *Whoami
- func (v *Whoami) CopyAsInterface() interface{}
- func (v *Whoami) Equal(u *Whoami) bool
- func (v *Whoami) IsValid() error
- func (v *Whoami) MarshalBinary() ([]byte, error)
- func (v *Whoami) MarshalJSON() ([]byte, error)
- func (v *Whoami) UnmarshalBinary(data []byte) error
- func (v *Whoami) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *Whoami) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddrInfo ¶
type AddrInfo struct { Info Addrs []p2p.Multiaddr `json:"addrs,omitempty" form:"addrs" query:"addrs" validate:"required"` // contains filtered or unexported fields }
func (*AddrInfo) CopyAsInterface ¶
func (v *AddrInfo) CopyAsInterface() interface{}
func (*AddrInfo) MarshalBinary ¶
func (*AddrInfo) MarshalJSON ¶
func (*AddrInfo) UnmarshalBinary ¶
func (*AddrInfo) UnmarshalJSON ¶
type Info ¶
type Info struct { ID p2p.PeerID `json:"id,omitempty" form:"id" query:"id" validate:"required"` Services []*ServiceInfo `json:"services,omitempty" form:"services" query:"services" validate:"required"` // contains filtered or unexported fields }
func (*Info) CopyAsInterface ¶
func (v *Info) CopyAsInterface() interface{}
func (*Info) HasService ¶
HasService returns true if Info includes the given Service.
func (*Info) MarshalBinary ¶
func (*Info) MarshalJSON ¶
func (*Info) UnmarshalBinary ¶
func (*Info) UnmarshalJSON ¶
type MessageStreamHandler ¶
A MessageStreamHandler handles an incoming message.Stream.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node implements peer-to-peer routing of API v3 messages over via binary message transport.
func (*Node) ConnectDirectly ¶
ConnectDirectly connects this node directly to another node.
func (*Node) Dialer ¶
func (n *Node) Dialer() message.MultiDialer
Dialer returns a message.MultiDialer that knows how to dial any partition or node in the network.
func (*Node) RegisterService ¶
func (n *Node) RegisterService(sa *api.ServiceAddress, handler MessageStreamHandler) bool
RegisterService registers a service handler.
func (*Node) SelfDialer ¶
SelfDialer returns a message.Dialer that always returns a stream for the current node.
func (*Node) WaitForService ¶
func (s *Node) WaitForService(sa *api.ServiceAddress)
WaitForService blocks until the given service is available. WaitForService will return once the service is registered on the current node or until the node is informed of a peer with the given service. WaitForService will return immediately if the service is already registered or known.
type Options ¶
type Options struct { Logger log.Logger // Listen is an array of addresses to listen on. Listen []multiaddr.Multiaddr // BootstrapPeers is an array of addresses of the bootstrap peers to connect // to on bootup. BootstrapPeers []multiaddr.Multiaddr // Key is the node's private key. If Key is omitted, the node will // generate a new key. Key ed25519.PrivateKey }
Options are options for creating a Node.
type PartitionOptions ¶
type PartitionOptions struct { // ID is the ID of the partition. ID string // Moniker is the Tendermint node's moniker. Moniker string }
PartitionOptions defines a Node's involvement in a partition.
type ServiceInfo ¶
type ServiceInfo struct { Address *api.ServiceAddress `json:"address,omitempty" form:"address" query:"address" validate:"required"` // contains filtered or unexported fields }
func (*ServiceInfo) Copy ¶
func (v *ServiceInfo) Copy() *ServiceInfo
func (*ServiceInfo) CopyAsInterface ¶
func (v *ServiceInfo) CopyAsInterface() interface{}
func (*ServiceInfo) Equal ¶
func (v *ServiceInfo) Equal(u *ServiceInfo) bool
func (*ServiceInfo) IsValid ¶
func (v *ServiceInfo) IsValid() error
func (*ServiceInfo) MarshalBinary ¶
func (v *ServiceInfo) MarshalBinary() ([]byte, error)
func (*ServiceInfo) UnmarshalBinary ¶
func (v *ServiceInfo) UnmarshalBinary(data []byte) error
func (*ServiceInfo) UnmarshalBinaryFrom ¶
func (v *ServiceInfo) UnmarshalBinaryFrom(rd io.Reader) error
type Whoami ¶
type Whoami struct { Self *Info `json:"self,omitempty" form:"self" query:"self" validate:"required"` Known []*AddrInfo `json:"known,omitempty" form:"known" query:"known" validate:"required"` // contains filtered or unexported fields }
func (*Whoami) CopyAsInterface ¶
func (v *Whoami) CopyAsInterface() interface{}