You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/LibP2PCore/Peer/Peer.swift
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,7 @@ import PeerID
34
34
// var addr:[Multiaddr] { get }
35
35
//}
36
36
37
+
/// A peer (PeerID) and their known addresses (Multiaddr)
37
38
publicstructPeerInfo{
38
39
publicletpeer:PeerID
39
40
publicletaddresses:[Multiaddr]
@@ -45,9 +46,10 @@ public struct PeerInfo {
45
46
}
46
47
47
48
extensionMultiaddr{
48
-
// TODO: Rename this to getPeerID once https://github.com/swift-libp2p/swift-multiaddr/issues/14 is addressed
49
-
func getPeerIDActual()throws->PeerID{
50
-
guardlet cid =self.getPeerID()else{
49
+
/// Attempts to extract a PeerID from the Multiaddr if one is present
50
+
/// - Note: The returned PeerID is usually only an ID and doesn't contain a key pair. In some instances (ED25519 keys) a public key might be recoverable.
51
+
publicfunc getPeerID()throws->PeerID{
52
+
guardlet cid =self.getPeerIDString()else{
51
53
throwNSError(domain:"No CID present in Multiaddr", code:0)
0 commit comments