MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / ConnectPeer

Method ConnectPeer

driver/ipfs-synckv/db.go:377–398  ·  view source on GitHub ↗
(ctx context.Context, addr string)

Source from the content-addressed store, hash-verified

375 defer wg.Done()
376 ipfsErr = db.ipfsDB.Delete(db.ctx, key)
377 _ = db.ipfsDB.Delete(db.ctx, append([]byte("_meta:"), key...)) // Delete meta
378 }()
379
380 wg.Wait()
381
382 if localErr != nil || ipfsErr != nil {
383 return fmt.Errorf("local error: %v, ipfs error: %v", localErr, ipfsErr)
384 }
385 db.cache.Del(key)
386 return nil
387}
388
389func (db *DB) ConnectPeer(ctx context.Context, addr string) error {
390 // Parse multiaddress
391 maddr, err := ma.NewMultiaddr(addr)
392 if err != nil {
393 return fmt.Errorf("invalid multiaddress: %w", err)
394 }
395
396 // Get peer info from multiaddress
397 peerInfo, err := peer.AddrInfoFromP2pAddr(maddr)
398 if err != nil {
399 return fmt.Errorf("invalid peer address: %w", err)
400 }
401

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected