Class: BlueWall::Rule

Inherits:
Struct
  • Object
show all
Defined in:
lib/bluewall.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionObject

Returns the value of attribute action

Returns:

  • (Object)

    the current value of action



10
11
12
# File 'lib/bluewall.rb', line 10

def action
  @action
end

#commentObject

Returns the value of attribute comment

Returns:

  • (Object)

    the current value of comment



10
11
12
# File 'lib/bluewall.rb', line 10

def comment
  @comment
end

#destinationObject

Returns the value of attribute destination

Returns:

  • (Object)

    the current value of destination



10
11
12
# File 'lib/bluewall.rb', line 10

def destination
  @destination
end

#directionObject

Returns the value of attribute direction

Returns:

  • (Object)

    the current value of direction



10
11
12
# File 'lib/bluewall.rb', line 10

def direction
  @direction
end

#dportObject

Returns the value of attribute dport

Returns:

  • (Object)

    the current value of dport



10
11
12
# File 'lib/bluewall.rb', line 10

def dport
  @dport
end

#gatewayObject

Returns the value of attribute gateway

Returns:

  • (Object)

    the current value of gateway



10
11
12
# File 'lib/bluewall.rb', line 10

def gateway
  @gateway
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



10
11
12
# File 'lib/bluewall.rb', line 10

def id
  @id
end

#interfaceObject

Returns the value of attribute interface

Returns:

  • (Object)

    the current value of interface



10
11
12
# File 'lib/bluewall.rb', line 10

def interface
  @interface
end

#nat_ruleObject

Returns the value of attribute nat_rule

Returns:

  • (Object)

    the current value of nat_rule



10
11
12
# File 'lib/bluewall.rb', line 10

def nat_rule
  @nat_rule
end

#protocolObject

Returns the value of attribute protocol

Returns:

  • (Object)

    the current value of protocol



10
11
12
# File 'lib/bluewall.rb', line 10

def protocol
  @protocol
end

#quickObject

Returns the value of attribute quick

Returns:

  • (Object)

    the current value of quick



10
11
12
# File 'lib/bluewall.rb', line 10

def quick
  @quick
end

#scheduleObject

Returns the value of attribute schedule

Returns:

  • (Object)

    the current value of schedule



10
11
12
# File 'lib/bluewall.rb', line 10

def schedule
  @schedule
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



10
11
12
# File 'lib/bluewall.rb', line 10

def source
  @source
end

#state_typeObject

Returns the value of attribute state_type

Returns:

  • (Object)

    the current value of state_type



10
11
12
# File 'lib/bluewall.rb', line 10

def state_type
  @state_type
end

Instance Method Details

#to_sObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bluewall.rb', line 11

def to_s
  parts = ["[#{id}] #{action} #{direction} on #{interface}"]
  parts << "proto=#{protocol}" if protocol && protocol != 'any'
  parts << "src=#{source}" if source && source != 'any'
  parts << "dst=#{destination}" if destination && destination != 'any'
  parts << "dport=#{dport}" if dport
  parts << "(Comment: #{comment})" if comment
  parts << "(Quick)" if quick
  parts << "(Schedule: #{schedule})" if schedule
  parts << "(Gateway: #{gateway})" if gateway
  parts << "(State: #{state_type})"
  parts << "(NAT Rule)" if nat_rule
  parts.join(" ")
end