func (t *Torrent) KnownSwarm() (ks []Peer) {
	// Add pending peers to the list
	t.peers.Each(func(peer Peer) {
		ks = append(ks, peer)
	})

	// Add half-open peers to the list
	for _, peer := range t.halfOpen {
		ks = append(ks, peer)
	}

	// Add active peers to the list
	for conn := range t.conns {

		ks = append(ks, Peer{
			Id:     conn.PeerID,
			Addr:   conn.remoteAddr,
			Source: conn.Discovery,
			// > If the connection is encrypted, that's certainly enough to set SupportsEncryption.
			// > But if we're not connected to them with an encrypted connection, I couldn't say
			// > what's appropriate. We can carry forward the SupportsEncryption value as we
			// > received it from trackers/DHT/PEX, or just use the encryption state for the
			// > connection. It's probably easiest to do the latter for now.
			// https://github.com/anacrolix/torrent/pull/188
			SupportsEncryption: conn.headerEncrypted,
		})
	}

	return
}
// KnownSwarm returns the known subset of the peers in the Torrent's swarm, including active,
// pending, and half-open peers.
KnownSwarm returns the known subset of the peers in the Torrent's swarm, including active,
pending, and half-open peers.
// KnownSwarm returns the known subset of the peers in the Torrent ' s swarm including active // pending and half - open peers .
func (t *Torrent) KnownSwarm() (ks []Peer) {
	t.peers.Each(func(peer Peer) {
		ks = append(ks, peer)
	})
	for _, peer := range t.halfOpen {
		ks = append(ks, peer)
	}
	for conn := range t.conns {
		ks = append(ks, Peer{
			Id:     conn.PeerID,
			Addr:   conn.remoteAddr,
			Source: conn.Discovery,
			SupportsEncryption: conn.headerEncrypted,
		})
	}
	return
}
func ( t * Torrent ) KnownSwarm ( ) ( ks [ ] Peer ) { t . peers . Each ( func ( peer Peer ) { ks = append ( ks , peer ) } ) for _ , peer := range t . halfOpen { ks = append ( ks , peer ) } for conn := range t . conns { ks = append ( ks , Peer { Id : conn . PeerID , Addr : conn . remoteAddr , Source : conn . Discovery , SupportsEncryption : conn . headerEncrypted , } ) } return }
KnownSwarm returns the known subset of the peers in the Torrent's swarm, including active,
pending, and half-open peers.
KnownSwarm returns the known subset of the peers in the Torrent ' s swarm including active pending and half - open peers .
// Add pending peers to the list // Add half-open peers to the list // Add active peers to the list // > If the connection is encrypted, that's certainly enough to set SupportsEncryption. // > But if we're not connected to them with an encrypted connection, I couldn't say // > what's appropriate. We can carry forward the SupportsEncryption value as we // > received it from trackers/DHT/PEX, or just use the encryption state for the // > connection. It's probably easiest to do the latter for now. // https://github.com/anacrolix/torrent/pull/188