Class: Construqt::Flavour::Ubuntu::Firewall::ToFrom
- Inherits:
-
Object
- Object
- Construqt::Flavour::Ubuntu::Firewall::ToFrom
show all
- Includes:
- Util::Chainable
- Defined in:
- lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb
Instance Method Summary
collapse
chainable_attr, chainable_attr_value, included
Instance Method Details
#bind_interface(ifname, iface, rule) ⇒ Object
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 93
def bind_interface(ifname, iface, rule)
self.interface(iface)
self.ifname(ifname)
if rule.from_is_inbound?
output_ifname_direction("-i")
input_ifname_direction("-o")
else
output_ifname_direction("-o")
input_ifname_direction("-i")
end
end
|
#factory! ⇒ Object
123
124
125
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 123
def factory!
get_factory.create
end
|
#get_begin_from ⇒ Object
68
69
70
71
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 68
def get_begin_from
return space_before(@begin_from) if @begin_from
return space_before(@begin)
end
|
#get_begin_to ⇒ Object
63
64
65
66
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 63
def get_begin_to
return space_before(@begin_to) if @begin_to
return space_before(@begin)
end
|
#get_end_from ⇒ Object
88
89
90
91
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 88
def get_end_from
return space_before(@end_from) if @end_from
return space_before(@end)
end
|
#get_end_to ⇒ Object
83
84
85
86
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 83
def get_end_to
return space_before(@end_to) if @end_to
return space_before(@end)
end
|
#get_middle_from ⇒ Object
78
79
80
81
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 78
def get_middle_from
return space_before(@middle_from) if @middle_from
return space_before(@middle)
end
|
#get_middle_to ⇒ Object
73
74
75
76
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 73
def get_middle_to
return space_before(@middle_to) if @middle_to
return space_before(@middle)
end
|
#has_from? ⇒ Boolean
119
120
121
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 119
def has_from?
@begin || @begin_from || @middle || @middle_from || @end || @end_from
end
|
#has_to? ⇒ Boolean
115
116
117
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 115
def has_to?
@begin || @begin_to || @middle || @middle_to || @end || @end_to
end
|
110
111
112
113
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 110
def input_ifname
return space_before("#{@input_ifname_direction} #{@ifname}") if @ifname
return ""
end
|
#only_in_out(rule) ⇒ Object
25
26
27
28
29
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 25
def only_in_out(rule)
output_only rule.output_only?
input_only rule.input_only?
self
end
|
#output_ifname ⇒ Object
105
106
107
108
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 105
def output_ifname
return space_before("#{@output_ifname_direction} #{@ifname}") if @ifname
return ""
end
|
#push_begin_from(str) ⇒ Object
43
44
45
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 43
def push_begin_from(str)
begin_from(get_begin_from + space_before(str))
end
|
#push_begin_to(str) ⇒ Object
39
40
41
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 39
def push_begin_to(str)
begin_to(get_begin_to + space_before(str))
end
|
#push_end_from(str) ⇒ Object
59
60
61
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 59
def push_end_from(str)
end_from(get_end_from + space_before(str))
end
|
#push_end_to(str) ⇒ Object
55
56
57
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 55
def push_end_to(str)
end_to(get_end_to + space_before(str))
end
|
#push_middle_from(str) ⇒ Object
51
52
53
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 51
def push_middle_from(str)
middle_from(get_middle_from + space_before(str))
end
|
#push_middle_to(str) ⇒ Object
47
48
49
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 47
def push_middle_to(str)
middle_to(get_middle_to + space_before(str))
end
|
#space_before(str) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb', line 31
def space_before(str)
if str.nil? or str.empty?
""
else
" "+str.strip
end
end
|