Class: Construqt::Flavour::Ubuntu::EtcConntrackdConntrackd

Inherits:
Object
  • Object
show all
Defined in:
lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb

Defined Under Namespace

Classes: Other

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ EtcConntrackdConntrackd

Returns a new instance of EtcConntrackdConntrackd.



7
8
9
10
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb', line 7

def initialize(result)
  @result = result
  @others = []
end

Instance Method Details

#add(ifname, my_ip, other_ip) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb', line 16

def add(ifname, my_ip, other_ip)
  other = Other.new
  other.ifname = ifname
  other.my_ip = my_ip
  other.other_ip = other_ip
  @others << other
end

#commitObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb', line 24

def commit
  return '' if @others.empty?
  out = ["General {\n  HashSize 32768\n  HashLimit 524288\n  Syslog on\n  LockFile /var/lock/conntrackd.lock\n  UNIX {\n    Path /var/run/conntrackd.sock\n    Backlog 20\n  }\n  SocketBufferSize 262142\n  SocketBufferSizeMaxGrown 655355\n  Filter {\n    Protocol Accept {\n      TCP\n    }\n    Address Ignore {\n      IPv4_address 127.0.0.1 # loopback\n    }\n  }\n}\nSync {\n  Mode FTFW {\n    DisableExternalCache Off\n    CommitTimeout 1800\n    PurgeTimeout 5\n  }\n"]
  @others.each do |other|
    out.push("  UDP Default {\n  IPv4_address \#{other.my_ip}\n  IPv4_Destination_Address \#{other.other_ip}\n  Port 3780\n  Interface \#{other.ifname}\n  SndSocketBuffer 24985600\n  RcvSocketBuffer 24985600\n  Checksum on\n  }\n")
  end
  out.push("}")
  out.join("\n")
end