Class: Net::NATPMP::Config
- Inherits:
-
Object
- Object
- Net::NATPMP::Config
- Defined in:
- lib/net/natpmp/config.rb
Overview
Provides all necessary configuration with some defaults
Constant Summary collapse
- NATPMP_PORT =
5351
- BIND_ADDRESS =
'0.0.0.0'
- BIND_PORT =
5350
Instance Attribute Summary collapse
-
#bind_address ⇒ Object
readonly
Returns the value of attribute bind_address.
-
#bind_port ⇒ Object
readonly
Returns the value of attribute bind_port.
-
#gw ⇒ Object
readonly
Returns the value of attribute gw.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(gw:, port: NATPMP_PORT, bind_address: BIND_ADDRESS, bind_port: BIND_PORT) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(gw:, port: NATPMP_PORT, bind_address: BIND_ADDRESS, bind_port: BIND_PORT) ⇒ Config
Returns a new instance of Config.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/net/natpmp/config.rb', line 13 def initialize( gw:, port: NATPMP_PORT, bind_address: BIND_ADDRESS, bind_port: BIND_PORT ) @bind_address = IPAddr.new(bind_address) @bind_port = bind_port @gw = IPAddr.new(gw) @port = port rescue IPAddr::InvalidAddressError raise InvalidParameter, 'Value must be a valid IP Address' end |
Instance Attribute Details
#bind_address ⇒ Object (readonly)
Returns the value of attribute bind_address.
11 12 13 |
# File 'lib/net/natpmp/config.rb', line 11 def bind_address @bind_address end |
#bind_port ⇒ Object (readonly)
Returns the value of attribute bind_port.
11 12 13 |
# File 'lib/net/natpmp/config.rb', line 11 def bind_port @bind_port end |
#gw ⇒ Object (readonly)
Returns the value of attribute gw.
11 12 13 |
# File 'lib/net/natpmp/config.rb', line 11 def gw @gw end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
11 12 13 |
# File 'lib/net/natpmp/config.rb', line 11 def port @port end |