Documentation
¶
Index ¶
- func BroadcastDiscovery() error
- func DetectOfflineNodes(activeNodes map[string]bool, shardMap map[string][]Shard)
- func DiscoverPeers(timeout time.Duration) ([]string, error)
- func DistributeShards(fileID string, fileData []byte, nodes []string) map[string][]Shard
- func ListenForPeers(timeout time.Duration) ([]string, error)
- func RedistributeShards(shards []Shard, activeNodes map[string]bool)
- func SetupDHT(ctx context.Context) (host.Host, *dht.IpfsDHT, error)
- func StartLibp2pDiscovery() (host.Host, *dht.IpfsDHT, error)
- type SecureChannel
- type Shard
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BroadcastDiscovery ¶
func BroadcastDiscovery() error
BroadcastDiscovery sends a UDP broadcast message to announce this node's presence.
func DetectOfflineNodes ¶
Check if a node storing shards is offline
func DiscoverPeers ¶
DiscoverPeers performs UDP-based peer discovery by broadcasting a message and then listening for responses.
func DistributeShards ¶
Function to distribute shards across nodes
func ListenForPeers ¶
ListenForPeers listens on UDP for incoming discovery messages for the specified timeout.
func RedistributeShards ¶
Redistribute lost shards to active nodes
Types ¶
type SecureChannel ¶
type SecureChannel struct {
SendCipher *noise.CipherState
RecvCipher *noise.CipherState
}
SecureChannel holds the cipher states for sending and receiving encrypted messages.
func PerformHandshakeInitiator ¶
func PerformHandshakeInitiator(conn io.ReadWriter, payload []byte) (*SecureChannel, error)
PerformHandshakeInitiator performs a complete Noise XX handshake as the initiator over the provided connection. It exchanges three handshake messages and returns a SecureChannel containing the cipher states for secure communication.
func PerformHandshakeResponder ¶
func PerformHandshakeResponder(conn io.ReadWriter, payload []byte) (*SecureChannel, error)
PerformHandshakeResponder performs a complete Noise XX handshake as the responder over the provided connection. It processes the initiator's messages, responds accordingly, and returns a SecureChannel with the cipher states.