Class: Net::NATPMP::MappingResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/net/natpmp/responses.rb

Overview

Response for the mapping request

Instance Attribute Summary collapse

Attributes inherited from Response

#raw_response

Instance Method Summary collapse

Constructor Details

#initialize(response, proto:) ⇒ MappingResponse

Returns a new instance of MappingResponse.



40
41
42
43
44
45
# File 'lib/net/natpmp/responses.rb', line 40

def initialize(response, proto:)
  super

  @proto = proto
  @inside_port, @outside_port, @lifetime = response.unpack('@8nnN')
end

Instance Attribute Details

#inside_portObject (readonly)

Returns the value of attribute inside_port.



38
39
40
# File 'lib/net/natpmp/responses.rb', line 38

def inside_port
  @inside_port
end

#lifetimeObject (readonly)

Returns the value of attribute lifetime.



38
39
40
# File 'lib/net/natpmp/responses.rb', line 38

def lifetime
  @lifetime
end

#outside_portObject (readonly)

Returns the value of attribute outside_port.



38
39
40
# File 'lib/net/natpmp/responses.rb', line 38

def outside_port
  @outside_port
end

#protoObject (readonly)

Returns the value of attribute proto.



38
39
40
# File 'lib/net/natpmp/responses.rb', line 38

def proto
  @proto
end

Instance Method Details

#inspectObject



47
48
49
# File 'lib/net/natpmp/responses.rb', line 47

def inspect
  "Port mapping: #{@outside_port} -> #{@proto}:#{@inside_port} (lifetime: #{@lifetime})"
end