Documentation
¶
Index ¶
- Constants
- func GetLibP2PClientBackendFactory() backends.ClientBackendFactory
- type CachedPeer
- type DHTCache
- type LibP2PClientBackend
- func (l *LibP2PClientBackend) CheckHealth() error
- func (l *LibP2PClientBackend) Close() error
- func (l *LibP2PClientBackend) EstablishRealtimeConn(jsonString string) (backends.RealtimeConnection, error)
- func (l *LibP2PClientBackend) SendMessage(method string, jsonString string, prvKey string, insecure bool, ...) (string, error)
- func (l *LibP2PClientBackend) SendRawMessage(jsonString string, insecure bool) (string, error)
- type LibP2PClientBackendFactory
- type PubSubRealtimeConnection
- type ServerPeer
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func GetLibP2PClientBackendFactory ¶
func GetLibP2PClientBackendFactory() backends.ClientBackendFactory
GetLibP2PClientBackendFactory returns a libp2p client backend factory This function is used to avoid import cycles while allowing registration
Types ¶
type CachedPeer ¶
type CachedPeer struct {
PeerID string `json:"peer_id"`
Addrs []string `json:"addrs"`
LastSeen time.Time `json:"last_seen"`
Rendezvous string `json:"rendezvous"`
}
CachedPeer represents a cached peer entry for serialization
type DHTCache ¶
type DHTCache struct {
Version int `json:"version"`
Updated time.Time `json:"updated"`
Peers []CachedPeer `json:"peers"`
}
DHTCache represents the DHT peer cache structure
type LibP2PClientBackend ¶
type LibP2PClientBackend struct {
// contains filtered or unexported fields
}
LibP2PClientBackend implements peer-to-peer client backend using libp2p
func NewLibP2PClientBackend ¶
func NewLibP2PClientBackend(config *backends.ClientConfig) (*LibP2PClientBackend, error)
NewLibP2PClientBackend creates a new libp2p client backend
func (*LibP2PClientBackend) CheckHealth ¶
func (l *LibP2PClientBackend) CheckHealth() error
CheckHealth checks the health of libp2p connections
func (*LibP2PClientBackend) Close ¶
func (l *LibP2PClientBackend) Close() error
Close closes the libp2p backend and cleans up resources
func (*LibP2PClientBackend) EstablishRealtimeConn ¶
func (l *LibP2PClientBackend) EstablishRealtimeConn(jsonString string) (backends.RealtimeConnection, error)
EstablishRealtimeConn establishes a real-time connection via libp2p pubsub
func (*LibP2PClientBackend) SendMessage ¶
func (l *LibP2PClientBackend) SendMessage(method string, jsonString string, prvKey string, insecure bool, ctx context.Context) (string, error)
SendMessage sends an RPC message with authentication via libp2p stream
func (*LibP2PClientBackend) SendRawMessage ¶
func (l *LibP2PClientBackend) SendRawMessage(jsonString string, insecure bool) (string, error)
SendRawMessage sends a raw JSON message via libp2p stream
type LibP2PClientBackendFactory ¶
type LibP2PClientBackendFactory struct{}
LibP2PClientBackendFactory creates libp2p client backends
func NewLibP2PClientBackendFactory ¶
func NewLibP2PClientBackendFactory() *LibP2PClientBackendFactory
NewLibP2PClientBackendFactory creates a new libp2p client backend factory
func (*LibP2PClientBackendFactory) CreateBackend ¶
func (f *LibP2PClientBackendFactory) CreateBackend(config *backends.ClientConfig) (backends.ClientBackend, error)
CreateBackend creates a new libp2p client backend
func (*LibP2PClientBackendFactory) GetBackendType ¶
func (f *LibP2PClientBackendFactory) GetBackendType() backends.ClientBackendType
GetBackendType returns the backend type this factory creates
type PubSubRealtimeConnection ¶
type PubSubRealtimeConnection struct {
// contains filtered or unexported fields
}
PubSubRealtimeConnection implements RealtimeConnection using libp2p pubsub
func NewPubSubRealtimeConnection ¶
func NewPubSubRealtimeConnection(topic *pubsub.Topic, subscription *pubsub.Subscription, ctx context.Context, localPeerID string) *PubSubRealtimeConnection
NewPubSubRealtimeConnection creates a new pubsub-based realtime connection
func (*PubSubRealtimeConnection) Close ¶
func (p *PubSubRealtimeConnection) Close() error
Close closes the pubsub realtime connection
func (*PubSubRealtimeConnection) ReadMessage ¶
func (p *PubSubRealtimeConnection) ReadMessage() (messageType int, data []byte, err error)
ReadMessage reads a message from the pubsub subscription
func (*PubSubRealtimeConnection) SetReadLimit ¶
func (p *PubSubRealtimeConnection) SetReadLimit(limit int64)
SetReadLimit sets the maximum size for incoming messages
func (*PubSubRealtimeConnection) WriteMessage ¶
func (p *PubSubRealtimeConnection) WriteMessage(messageType int, data []byte) error
WriteMessage writes a message to the pubsub topic