Packages that use Peer
Package
Description
I2P version of the Snark BitTorrent client, enhanced for I2P: peers are I2P destinations, torrents can be served anonymously as hidden services, and metadata carries I2P-specific comment fields.
The I2PSnark web interface (i2psnark.war): servlets and helpers for torrent management, file browsing and configuration.
Uses of Peer in org.klomp.snark
Subclasses of Peer in org.klomp.snarkClasses in org.klomp.snark that implement interfaces with type arguments of type PeerModifier and TypeClassDescriptionclassRepresents a peer in the BitTorrent network, managing all public information and communication with that peer.Fields in org.klomp.snark declared as PeerModifier and TypeFieldDescriptionprivate final PeerPeerConnectionIn.peerThe peer being read from.private final PeerPeerConnectionOut.peerThe peer this connection serves.private final PeerPeerState.peerThe peer this state describes.Fields in org.klomp.snark with type parameters of type PeerModifier and TypeFieldDescriptionPeerCoordinator.peersSynchronize on this when changing peers or downloaders.TrackerInfo.peersThe peers from the response, unmodifiable and never null: a failure response has no peers, and is reported byTrackerInfo.getFailureReason()instead.Methods in org.klomp.snark that return PeerModifier and TypeMethodDescriptionprivate static PeerPeerCoordinator.peerIDInList(PeerID pid, Collection<Peer> peers) The peer with the given ID, or null.Methods in org.klomp.snark that return types with arguments of type PeerModifier and TypeMethodDescriptionSnark.getPeerList()The peer list.TrackerInfo.getPeers()Peers returned by the tracker.TrackerInfo.getPeers(byte[] l, byte[] my_id, byte[] infohash, MetaInfo metainfo, I2PSnarkUtil util) One big string of concatenated 32-byte hashes.TrackerInfo.getPeers(List<BEValue> l, byte[] my_id, byte[] infohash, MetaInfo metainfo, I2PSnarkUtil util) List of Dictionaries or List of Strings.TrackerInfo.getPeers(Set<Hash> hashes, byte[] my_id, byte[] infohash, MetaInfo metainfo, I2PSnarkUtil util) From Hash to Peer.PeerCoordinator.peerList()Returns a snapshot of the connected peers list for web page detailed stats.Methods in org.klomp.snark with parameters of type PeerModifier and TypeMethodDescriptionbooleanAdd peer (inbound or outbound).booleanAdds a peer to the set of peers that have this piece.intCompares this peer to another byPeerID, then by internal ID.voidCalled when a peer connection is established.voidCalled when the connection to the peer has started and the handshake was successful.voidPeerCoordinator.disconnected(Peer peer) Called when a peer disconnects.voidPeerListener.disconnected(Peer peer) Called when the connection to the peer was terminated or the connection handshake failed.PeerCoordinator.getPartialPiece(Peer peer, int piece) Allocates a PartialPiece for a specific suggested piece, or returns null if the piece is not wanted, is already being fetched, or the peer is already fetching it.PeerCoordinator.getPartialPiece(Peer peer, BitField havePieces) Return partial piece to the PeerState if it's still wanted and peer has it.PeerCoordinator.getPartialPiece(Peer peer, BitField havePieces, Set<Integer> allowed) Return partial piece to the PeerState if it's still wanted and peer has it.PeerListener.getPartialPiece(Peer peer, int piece) Called when the peer suggests a specific piece via a BEP 6 suggest message.PeerListener.getPartialPiece(Peer peer, BitField havePieces) Called when a peer has connected and there may be a partially downloaded piece that the coordinatorator can give the peer task.PeerListener.getPartialPiece(Peer peer, BitField havePieces, Set<Integer> allowed) Called when a peer has connected and there may be a partially downloaded piece that the coordinator can give the peer task.booleanPeerCoordinator.gotBitField(Peer peer, BitField bitfield) Returns true if the given bitfield contains at least one piece we are interested in.booleanPeerListener.gotBitField(Peer peer, BitField bitfield) Called when a bitmap message is received.voidCalled when a choke message is received.voidCalled when a choke message is received.voidPeerCoordinator.gotCommentReq(Peer peer, int num) Called when comments are requested via ut_comment.voidPeerListener.gotCommentReq(Peer peer, int num) Called when comments are requested via ut_comment.voidPeerCoordinator.gotComments(Peer peer, List<Comment> comments) Called when comments are received via ut_comment.voidPeerListener.gotComments(Peer peer, List<Comment> comments) Called when comments are received via ut_comment.voidPeerCoordinator.gotExtension(Peer peer, int id, byte[] bs) PeerListener callback.voidPeerListener.gotExtension(Peer peer, int id, byte[] bs) Called when an extension message is received.booleanWhether we still want the given piece.booleanCalled when a have piece message is received.voidPeerCoordinator.gotInterest(Peer peer, boolean interest) Called when an interested message is received.voidPeerListener.gotInterest(Peer peer, boolean interest) Called when an interested message is received.voidHandle peers from PEX; a PeerListener callback.voidCalled when peers are received via PEX.booleanPeerCoordinator.gotPiece(Peer peer, PartialPiece pp) Returns false if the piece is no good (according to the hash).booleanPeerListener.gotPiece(Peer peer, PartialPiece piece) Called when a piece is received from the peer.voidPeerListener callback Tell the DHT to ping it, this will get back the node info.voidCalled when a DHT port message is received.PeerCoordinator.gotRequest(Peer peer, int piece, int off, int len) Returns a byte array containing the requested piece or null of the piece is unknown.PeerListener.gotRequest(Peer peer, int piece, int off, int len) Called when the peer wants (part of) a piece from us.private static voidExtensionHandler.handleComment(Peer peer, PeerListener listener, byte[] bs, Log log) Handles an incoming comment request or response message.private static voidExtensionHandler.handleDHT(Peer peer, PeerListener listener, byte[] bs, Log log) Handles an incoming DHT port message.private static voidExtensionHandler.handleHandshake(Peer peer, PeerListener listener, byte[] bs, Log log) Handles an incoming extension handshake message.static voidExtensionHandler.handleMessage(Peer peer, PeerListener listener, int id, byte[] bs) Handles an incoming extension message from a peer.private static voidExtensionHandler.handleMetadata(Peer peer, PeerListener listener, byte[] bs, Log log) Handles an incoming metadata extension message (BEP 9).private static voidExtensionHandler.handlePEX(Peer peer, PeerListener listener, byte[] bs, Log log) Handles an incoming PEX message.booleanPiece.isRequestedBy(Peer peer) Checks if the given peer is currently requesting this piece.static voidExtensionHandler.locked_sendComments(Peer peer, int num, CommentSet comments) Sends comments to a peer.private voidPeerCoordinator.markUnrequested(Peer peer, int piece) Clear the requested flag for a piece.booleanCalled when we are downloading from the peer and may need to ask for a new piece.booleanCalled when we are downloading from the peer and may need to ask for a new piece.voidCoordinatorListener.peerChange(PeerCoordinator coordinator, Peer peer) Called when the PeerCoordinator notices a change in the state of a peer.voidSnark.peerChange(PeerCoordinator coordinator, Peer peer) CoordinatorListener no-op.(package private) voidPeerCoordinator.recordSwarmPeer(Peer peer) Record a peer surfaced by any source (announce, PEX, DHT, inbound) as a distinct swarm member, keyed by destination hash.booleanPiece.removePeer(Peer peer) Removes a peer from those that have this piece.private voidPeerCoordinator.removePeerFromPieces(Peer peer) Called when a peer is removed, to prevent it from being used in rarest-first calculations.voidPeerCoordinator.savePartialPieces(Peer peer, List<Request> partials) Save partial pieces on peer disconnection and hopefully restart it later.voidPeerListener.savePartialPieces(Peer peer, List<Request> pcs) Called when the peer has disconnected and the peer task may have a partially downloaded piece that the PeerCoordinator can save.static voidExtensionHandler.sendCommentReq(Peer peer, int num) Sends a comment request to a peer.(package private) voidPeerCoordinator.sendCommentReq(Peer peer) Send a comment request message to the peer, if he supports it.static voidSends DHT port numbers to a peer.(package private) voidSend a DHT message to the peer, if we both support DHT.static voidExtensionHandler.sendDontHave(Peer peer, int piece) Send a BEP 54 lt_donthave message to a peer that advertised support: the piece is no longer available.private static voidExtensionHandler.sendExtension(Peer peer, String type, byte[] payload) Send an extension message to a peer, looking up its message code for the given type in the handshake.private static voidExtensionHandler.sendMessage(Peer peer, int type, int piece) Sends a metadata request or reject message to a peer.(package private) voidSend a PEX message to the peer, if he supports PEX.static voidSends a PEX message with the given peer list.private static voidSends a metadata chunk data message to a peer.private static voidExtensionHandler.sendRequest(Peer peer, int piece) Sends a metadata chunk request to a peer.voidPiece.setRequested(Peer peer, boolean requested) Marks a peer as requesting or no longer requesting this piece.booleanBandwidthListener.shouldRequest(Peer peer, int size) Checks if we should request the given number of bytes from a peer.booleanBandwidthManager.shouldRequest(Peer peer, int size) Should we request this many bytes?booleanPeer.shouldRequest(Peer peer, int size) Should we request this many bytes? Only true for this peer, which is how a callback that was handed one peer is prevented from answering for another.booleanPeerCoordinator.shouldRequest(Peer peer, int size) Should we request this many bytes?private PieceReturns one of pieces in the given BitField that is still wanted or null if none of the given pieces are wanted.private PieceReturns one of the claimed pieces in the given BitField that is still wanted or null if none of the given pieces are wanted.Method parameters in org.klomp.snark with type arguments of type PeerModifier and TypeMethodDescriptionprivate static PeerPeerCoordinator.peerIDInList(PeerID pid, Collection<Peer> peers) The peer with the given ID, or null.static voidSends a PEX message with the given peer list.private voidTrackerClient.tryAddPeers(Collection<Peer> peers) Try to connect to the given peers, spreading the connection attempts over time.Constructors in org.klomp.snark with parameters of type PeerModifierConstructorDescriptionPeerConnectionIn(Peer peer, DataInputStream din) Create a handler for incoming messages from a peer.PeerConnectionOut(Peer peer, DataOutputStream dout) Creates a new outgoing connection handler.(package private)PeerState(Peer peer, PeerListener listener, BandwidthListener bwl, MetaInfo metainfo, PeerConnectionIn in, PeerConnectionOut out) Create the peer state for the torrent.Uses of Peer in org.klomp.snark.web
Classes in org.klomp.snark.web that implement interfaces with type arguments of type PeerModifier and TypeClassDescriptionprivate static classSort by completeness (seeds first), then by ID.Methods in org.klomp.snark.web with parameters of type PeerModifier and TypeMethodDescriptionprivate voidI2PSnarkServlet.appendPeerRow(StringBuilder buf, Peer peer, Snark snark, MetaInfo meta, boolean noThinsp) Appends HTML for a single peer row to the given StringBuilder.(package private) static I2PSnarkServlet.PeerStatusI2PSnarkServlet.classifyPeerStatus(Peer peer) Determines the peer status (active/inactive with TX/RX flags).intprivate StringI2PSnarkServlet.getClientName(Peer peer) Returns a human-readable name of the client associated with the given Peer.private voidI2PSnarkServlet.renderDownloadRate(StringBuilder buf, Peer peer, I2PSnarkServlet.PeerRowContext ctx, long needed) Renders the download rate cell.private voidI2PSnarkServlet.renderPeerIdentity(StringBuilder buf, Peer peer, I2PSnarkServlet.PeerRowContext ctx) Renders the peer identity/client section.private floatI2PSnarkServlet.renderPeerProgress(StringBuilder buf, Peer peer, I2PSnarkServlet.PeerRowContext ctx) Renders the peer progress bar or seed indicator.private voidI2PSnarkServlet.renderUploadRate(StringBuilder buf, Peer peer, I2PSnarkServlet.PeerRowContext ctx, float pct, boolean isValid) Renders the upload rate cell.