class Ciri::P2P::Address

Attributes

ip[R]
tcp_port[R]
udp_port[R]

Public Class Methods

new(ip:, udp_port:, tcp_port: udp_port) click to toggle source
# File lib/ciri/p2p/address.rb, line 30
def initialize(ip:, udp_port:, tcp_port: udp_port)
  @ip = ip.is_a?(IPAddr) ? ip : IPAddr.new(ip)
  @udp_port = udp_port
  @tcp_port = tcp_port
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/ciri/p2p/address.rb, line 40
def <=>(other)
  ip <=> other.ip
end
==(other) click to toggle source
# File lib/ciri/p2p/address.rb, line 36
def ==(other)
  self.class == other.class && ip == other.ip && udp_port == other.udp_port
end
inspect() click to toggle source
# File lib/ciri/p2p/address.rb, line 44
def inspect
  "<PeerStore::Address #{ip.inspect} udp_port: #{udp_port} tcp_port: #{tcp_port}>"
end