Sha256: 43c7de9e1b40df8756e8c4991e05b47fdec5ef6cfd5d27f9edd930834fcee933

Contents?: true

Size: 542 Bytes

Versions: 3

Compression:

Stored size: 542 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2017-2024, by Samuel Williams.

module Protocol
	module HTTP
		# Provide a well defined, cached representation of a peer (address).
		class Peer
			def self.for(io)
				if address = io.remote_address
					return new(address)
				end
			end
			
			def initialize(address)
				@address = address
				
				if address.ip?
					@ip_address = @address.ip_address
				end
			end
			
			attr :address
			attr :ip_address
			
			alias remote_address address
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
protocol-http-0.45.0 lib/protocol/http/peer.rb
protocol-http-0.44.0 lib/protocol/http/peer.rb
protocol-http-0.43.0 lib/protocol/http/peer.rb