diff options
| author | Paul Buetow <paul@buetow.org> | 2025-04-19 00:43:41 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-04-19 00:43:41 +0300 |
| commit | bcc6b0c153aa7271bc9c3a07b217fbd394890024 (patch) | |
| tree | 2800b5b42eee7abc4a8e20f6fccd2afc1eaeea90 | |
| parent | 45563c9c6cb686da1bfa092194f5c690f01ff364 (diff) | |
better
| -rw-r--r-- | wireguardmeshgenerator.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/wireguardmeshgenerator.rb b/wireguardmeshgenerator.rb index 95f7b70..19949ff 100644 --- a/wireguardmeshgenerator.rb +++ b/wireguardmeshgenerator.rb @@ -67,7 +67,7 @@ WireguardConfig = Struct.new(:myself, :hosts) do PresharedKey = #{keytool.preshared} ListenPort = 56709 - #{peer_snippets} + #{peers(&:to_s).join("\n")} CONFIG end @@ -79,11 +79,13 @@ WireguardConfig = Struct.new(:myself, :hosts) do private - def peer_snippets + def peers hosts.reject { _1 == myself }.map do |hostname, data| - PeerSnippet.new(hostname, data['wg0']['domain'], - data['wg0']['ip'], data['lan']['ip']) - end.map(&:to_s).join("\n") + PeerSnippet.new(hostname, + data['wg0']['domain'], + data['wg0']['ip'], + data['lan']['ip']) + end end end |
