File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,18 @@ module Protocol
77 module HTTP
88 # Provide a well defined, cached representation of a peer (address).
99 class Peer
10+ # Create a new peer object for the given IO object, using the remote address if available.
11+ #
12+ # @returns [Peer | Nil] The peer object, or nil if the remote address is not available.
1013 def self . for ( io )
1114 if address = io . remote_address
1215 return new ( address )
1316 end
1417 end
1518
19+ # Initialize the peer with the given address.
20+ #
21+ # @parameter address [Addrinfo] The remote address of the peer.
1622 def initialize ( address )
1723 @address = address
1824
@@ -21,7 +27,10 @@ def initialize(address)
2127 end
2228 end
2329
30+ # @attribute [Addrinfo] The remote address of the peer.
2431 attr :address
32+
33+ # @attribute [String] The IP address of the peer, if available.
2534 attr :ip_address
2635
2736 alias remote_address address
You can’t perform that action at this time.
0 commit comments