func makePeerStatusSlice(peers *Peers) []PeerStatus {
	var slice []PeerStatus

	peers.forEach(func(peer *Peer) {
		var connections []connectionStatus
		if peer == peers.ourself.Peer {
			for conn := range peers.ourself.getConnections() {
				connections = append(connections, makeConnectionStatus(conn))
			}
		} else {
			// Modifying peer.connections requires a write lock on
			// Peers, and since we are holding a read lock (due to the
			// ForEach), access without locking the peer is safe.
			for _, conn := range peer.connections {
				connections = append(connections, makeConnectionStatus(conn))
			}
		}
		slice = append(slice, PeerStatus{
			peer.Name.String(),
			peer.NickName,
			peer.UID,
			peer.ShortID,
			peer.Version,
			connections,
		})
	})

	return slice
}
func makePeerStatusSlice(peers *Peers) []PeerStatus {
	var slice []PeerStatus

	peers.forEach(func(peer *Peer) {
		var connections []connectionStatus
		if peer == peers.ourself.Peer {
			for conn := range peers.ourself.getConnections() {
				connections = append(connections, makeConnectionStatus(conn))
			}
		} else {
			
			
			
			for _, conn := range peer.connections {
				connections = append(connections, makeConnectionStatus(conn))
			}
		}
		slice = append(slice, PeerStatus{
			peer.Name.String(),
			peer.NickName,
			peer.UID,
			peer.ShortID,
			peer.Version,
			connections,
		})
	})

	return slice
}
func makePeerStatusSlice ( peers * Peers ) [ ] PeerStatus { var slice [ ] PeerStatus peers . forEach ( func ( peer * Peer ) { var connections [ ] connectionStatus if peer == peers . ourself . Peer { for conn := range peers . ourself . getConnections ( ) { connections = append ( connections , makeConnectionStatus ( conn ) ) } } else { // Modifying peer.connections requires a write lock on // Peers, and since we are holding a read lock (due to the // ForEach), access without locking the peer is safe. for _ , conn := range peer . connections { connections = append ( connections , makeConnectionStatus ( conn ) ) } } slice = append ( slice , PeerStatus { peer . Name . String ( ) , peer . NickName , peer . UID , peer . ShortID , peer . Version , connections , } ) } ) return slice }
// makePeerStatusSlice takes a snapshot of the state of peers.
makePeerStatusSlice takes a snapshot of the state of peers .