Documentation
¶
Index ¶
- Constants
- type HostImpl
- type HostStatus
- func (s HostStatus) Equals(other HostStatus) bool
- func (s HostStatus) IsClosed() bool
- func (s HostStatus) IsConnecting() bool
- func (s HostStatus) IsFail() bool
- func (s HostStatus) IsNotIdle() bool
- func (s HostStatus) IsReady() bool
- func (s HostStatus) IsStandby() bool
- func (s HostStatus) String() string
- type SockManager
Constants ¶
View Source
const UDSDir = "sock"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HostImpl ¶ added in v0.15.2
type HostImpl interface {
// AuthenticateMessage authenticates a message
AuthenticateMessage(msg proto.Message, metadata *types.Metadata) bool
// Close closes the node
Close()
// Connect to a peer
Connect(pi peer.AddrInfo) error
// HasRouting returns true if the node has routing
HasRouting() error
// Host returns the Host
Host() host.Host
// HostID returns the ID of the Host
HostID() peer.ID
// Join subsrcibes to a topic
Join(topic string, opts ...ps.TopicOpt) (*ps.Topic, error)
// NewStream opens a new stream to a peer
NewStream(ctx context.Context, pid peer.ID, pids ...protocol.ID) (network.Stream, error)
// NewTopic creates a new pubsub topic with event handler and subscription
NewTopic(topic string, opts ...ps.TopicOpt) (*ps.Topic, *ps.TopicEventHandler, *ps.Subscription, error)
// NeedsWait checks if state is Resumed or Paused and blocks channel if needed
NeedsWait()
// Pause tells all of goroutines to pause execution
Pause()
// Ping sends a ping to a peer to check if it is alive
Ping(id string) error
// Peer returns the peer of the node
Peer() (*types.Peer, error)
// Pubsub returns the pubsub of the node
Pubsub() *ps.PubSub
// Resume tells all of goroutines to resume execution
Resume()
// Role returns the role of the node
Role() device.Role
// Router returns the routing.Router
Router(h host.Host) (routing.PeerRouting, error)
// Routing returns the routing.Routing
Routing() routing.Routing
// PrivateKey returns the ed25519 private key instance of the libp2p host
PrivateKey() (ed25519.PrivateKey, error)
// SendMessage sends a message to a peer
SendMessage(id peer.ID, p protocol.ID, data proto.Message) error
// SetStreamHandler sets the handler for a protocol
SetStreamHandler(protocol protocol.ID, handler network.StreamHandler)
// SignData signs the data with the private key
SignData(data []byte) ([]byte, error)
// SignMessage signs a message with the node's private key
SignMessage(message proto.Message) ([]byte, error)
// VerifyData verifies the data signature
VerifyData(data []byte, signature []byte, peerId peer.ID, pubKeyData []byte) bool
}
HostImpl returns the HostImpl for the Main Node
type HostStatus ¶ added in v0.15.2
type HostStatus int
HostStatus is the status of the host
const ( Status_IDLE HostStatus = iota // Host is idle, default state Status_STANDBY // Host is standby, waiting for connection Status_CONNECTING // Host is connecting Status_READY // Host is ready Status_FAIL // Host failed to connect Status_CLOSED // Host is closed )
SNRHostStatus Definitions
func (HostStatus) Equals ¶ added in v0.15.2
func (s HostStatus) Equals(other HostStatus) bool
Equals returns true if given SNRHostStatus matches this one
func (HostStatus) IsClosed ¶ added in v0.15.2
func (s HostStatus) IsClosed() bool
IsClosed returns true if the SNRHostStatus == Status_CLOSED
func (HostStatus) IsConnecting ¶ added in v0.15.2
func (s HostStatus) IsConnecting() bool
IsConnecting returns true if the SNRHostStatus == Status_CONNECTING
func (HostStatus) IsFail ¶ added in v0.15.2
func (s HostStatus) IsFail() bool
IsFail returns true if the SNRHostStatus == Status_FAIL
func (HostStatus) IsNotIdle ¶ added in v0.15.2
func (s HostStatus) IsNotIdle() bool
IsNotIdle returns true if the SNRHostStatus != Status_IDLE
func (HostStatus) IsReady ¶ added in v0.15.2
func (s HostStatus) IsReady() bool
IsReady returns true if the SNRHostStatus == Status_READY
func (HostStatus) IsStandby ¶ added in v0.15.2
func (s HostStatus) IsStandby() bool
IsStandby returns true if the SNRHostStatus == Status_STANDBY
func (HostStatus) String ¶ added in v0.15.2
func (s HostStatus) String() string
String returns the string representation of the SNRHostStatus
type SockManager ¶
type SockManager struct {
// contains filtered or unexported fields
}
func NewSockManager ¶
func NewSockManager(path string) (*SockManager, error)
func (*SockManager) NewSockPath ¶
func (sm *SockManager) NewSockPath() (string, error)
Click to show internal directories.
Click to hide internal directories.