summaryrefslogtreecommitdiff
path: root/manifests/daemon/relay.pp
blob: bc72dd02d20ee2833f0edf747a30773cb4c47678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# relay definition
define tor::daemon::relay(
  $ensure                  = 'present',
  $port                    = 0,
  $outbound_bindaddresses  = [],
  $portforwarding          = 0,
  # KB/s, defaulting to using tor's default: 5120KB/s
  $bandwidth_rate          = '',
  # KB/s, defaulting to using tor's default: 10240KB/s
  $bandwidth_burst         = '',
  # KB/s, 0 for no limit
  $relay_bandwidth_rate    = 0,
  # KB/s, 0 for no limit
  $relay_bandwidth_burst   = 0,
  # GB, 0 for no limit
  $accounting_max          = 0,
  $accounting_start        = 'month 1 0:00',
  $contact_info            = '',
  # TODO: autofill with other relays
  $my_family               = '',
  $address                 = "tor.${::domain}",
  $bridge_relay            = 0,
) {

  if $ensure == 'present' {
    $nickname = $name

    if $outbound_bindaddresses == [] {
      $real_outbound_bindaddresses = []
    } else {
      $real_outbound_bindaddresses = $outbound_bindaddresses
    }

    concat::fragment { '03.relay':
      content => template('tor/torrc.relay.erb'),
      order   => '03',
      target  => $tor::daemon::config_file,
    }
  }
}