- * Get a list of tuples mapping from node id to network addresses for peers which have
- * completed the initial handshake.
+ * Returns a list of [`PeerDetails`] for connected peers that have completed the initial
+ * handshake.
+ */
+ public PeerDetails[] list_peers() {
+ long ret = bindings.PeerManager_list_peers(this.ptr);
+ GC.KeepAlive(this);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ int ret_conv_13_len = InternalUtils.getArrayLength(ret);
+ PeerDetails[] ret_conv_13_arr = new PeerDetails[ret_conv_13_len];
+ for (int n = 0; n < ret_conv_13_len; n++) {
+ long ret_conv_13 = InternalUtils.getU64ArrayElem(ret, n);
+ org.ldk.structs.PeerDetails ret_conv_13_hu_conv = null; if (ret_conv_13 < 0 || ret_conv_13 > 4096) { ret_conv_13_hu_conv = new org.ldk.structs.PeerDetails(null, ret_conv_13); }
+ if (ret_conv_13_hu_conv != null) { ret_conv_13_hu_conv.ptrs_to.AddLast(this); };
+ ret_conv_13_arr[n] = ret_conv_13_hu_conv;
+ }
+ bindings.free_buffer(ret);
+ return ret_conv_13_arr;
+ }
+
+ /**
+ * Returns the [`PeerDetails`] of a connected peer that has completed the initial handshake.