puffy 0.2.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29faa3d9a8f47338dd25bd99d2256bc7bfa60a6790f3e39e8613a86c540bb30a
4
- data.tar.gz: 345aa1d4ef63d8b7ebcb05f4892a690a81c385fb41ed3c5bc48406bd70ca2ba0
3
+ metadata.gz: b05f6a865607d5ece6a83d81f3ef925decf281b4fa0fc54daf7aaa2213135831
4
+ data.tar.gz: 9ac1891cb02cf876b0ac64fc19dc857996c1e3dfa3141e5b339c82f98603ced9
5
5
  SHA512:
6
- metadata.gz: 5ccead5c447d76590049b2ac548c771bb34d548a2b51ce2b479586926c1a3c7940cce7cc5a24f7a9ac2c15d3c4398fe1fc1c0dad215bda2e3273f68c4dd14a9e
7
- data.tar.gz: a18934dc97ae9d09ce7dda9b33efb9d35962db15858c234f8a85830967813d74c6049e5f74d917482085a72bb0ac5b86e122daf2d293abdc06b22df06a6f968b
6
+ metadata.gz: 73c1d65f67292e4e3d2452978ad21bc2bca7001cce5304472686a8a843bf742e635b11c86606f43a1af1024cb30bf63faf7f1444cc4b380ee7f589300086bb2b
7
+ data.tar.gz: f93e5ffc88eda099624f28ce13997dbe0a9222955eb76aa6e5e725d77be3a313da0b38ccddf3f10a550f60418cb44e39bb3724e2a02aab952c2a6b643ec7d28c
@@ -0,0 +1,18 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ # Open PR for gem updates
9
+ - package-ecosystem: "bundler" # See documentation for possible values
10
+ directory: "/" # Location of package manifests
11
+ schedule:
12
+ interval: "daily"
13
+
14
+ # Open PR for GitHub Actions updates
15
+ - package-ecosystem: "github-actions"
16
+ directory: "/"
17
+ schedule:
18
+ interval: "daily"
@@ -14,7 +14,7 @@ jobs:
14
14
  rubocop:
15
15
  runs-on: ubuntu-latest
16
16
  steps:
17
- - uses: actions/checkout@v2
17
+ - uses: actions/checkout@v4
18
18
  - name: Setup ruby
19
19
  uses: ruby/setup-ruby@v1
20
20
  with:
@@ -32,9 +32,11 @@ jobs:
32
32
  - "2.7"
33
33
  - "3.0"
34
34
  - "3.1"
35
+ - "3.2"
36
+ - "3.3"
35
37
  name: Ruby ${{ matrix.ruby }}
36
38
  steps:
37
- - uses: actions/checkout@v2
39
+ - uses: actions/checkout@v4
38
40
  - name: Setup ruby
39
41
  uses: ruby/setup-ruby@v1
40
42
  with:
@@ -47,7 +49,7 @@ jobs:
47
49
  run: bundle exec rake
48
50
  - name: Run tests and upload coverage to Code Climate
49
51
  if: ${{ matrix.ruby == '3.0' }}
50
- uses: paambaati/codeclimate-action@v3.0.0
52
+ uses: paambaati/codeclimate-action@v5.0.0
51
53
  env:
52
54
  CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
53
55
  with:
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ AllCops:
3
3
  AllowSymlinksInCacheRootDirectory: true
4
4
  NewCops: enable
5
5
  Exclude:
6
- - lib/melt/*.tab.rb
6
+ - lib/puffy/*.tab.rb
7
7
  - tmp/**/*.rb
8
8
  - vendor/bundle/**/*
9
9
 
data/CHANGELOG.md CHANGED
@@ -1,6 +1,35 @@
1
1
  # Changelog
2
2
 
3
- ## [v0.2.0](https://github.com/opus-codium/puffy/tree/v0.2.0) (2022-12-17)
3
+ ## [v1.0.0](https://github.com/opus-codium/puffy/tree/v1.0.0) (2024-04-09)
4
+
5
+ [Full Changelog](https://github.com/opus-codium/puffy/compare/v0.3.1...v1.0.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Setup dependabot [\#36](https://github.com/opus-codium/puffy/pull/36) ([smortex](https://github.com/smortex))
10
+ - Add support for Ruby 3.3 [\#33](https://github.com/opus-codium/puffy/pull/33) ([smortex](https://github.com/smortex))
11
+
12
+ ## [v0.3.1](https://github.com/opus-codium/puffy/tree/v0.3.1) (2023-11-22)
13
+
14
+ [Full Changelog](https://github.com/opus-codium/puffy/compare/v0.3.0...v0.3.1)
15
+
16
+ **Fixed bugs:**
17
+
18
+ - Ensure parser is up-to-date before build [\#31](https://github.com/opus-codium/puffy/pull/31) ([smortex](https://github.com/smortex))
19
+
20
+ ## [v0.3.0](https://github.com/opus-codium/puffy/tree/v0.3.0) (2023-01-04)
21
+
22
+ [Full Changelog](https://github.com/opus-codium/puffy/compare/v0.2.0...v0.3.0)
23
+
24
+ **Implemented enhancements:**
25
+
26
+ - Add support for nested variables [\#29](https://github.com/opus-codium/puffy/pull/29) ([smortex](https://github.com/smortex))
27
+
28
+ **Fixed bugs:**
29
+
30
+ - Fix iptables rules without direction [\#28](https://github.com/opus-codium/puffy/pull/28) ([smortex](https://github.com/smortex))
31
+
32
+ ## [v0.2.0](https://github.com/opus-codium/puffy/tree/v0.2.0) (2022-12-18)
4
33
 
5
34
  [Full Changelog](https://github.com/opus-codium/puffy/compare/v0.1.0...v0.2.0)
6
35
 
data/Gemfile CHANGED
@@ -4,3 +4,16 @@ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in puffy.gemspec
6
6
  gemspec
7
+
8
+ gem 'aruba'
9
+ gem 'bundler'
10
+ gem 'cucumber'
11
+ gem 'github_changelog_generator'
12
+ gem 'racc'
13
+ gem 'rake'
14
+ gem 'rspec'
15
+ gem 'rubocop'
16
+ gem 'rubocop-rake'
17
+ gem 'rubocop-rspec'
18
+ gem 'simplecov'
19
+ gem 'timecop'
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ Cucumber::Rake::Task.new(:features)
14
14
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
15
15
  config.user = 'opus-codium'
16
16
  config.project = 'puffy'
17
- config.exclude_labels = ['skip-changelog']
17
+ config.exclude_labels = %w[dependencies skip-changelog]
18
18
  config.future_release = "v#{Puffy::VERSION}"
19
19
  end
20
20
 
@@ -22,9 +22,11 @@ task test: %i[spec features]
22
22
 
23
23
  task default: :test
24
24
 
25
+ task build: :gen_parser
26
+
25
27
  desc 'Generate the puffy language parser'
26
28
  task gen_parser: 'lib/puffy/parser.tab.rb'
27
29
 
28
30
  file 'lib/puffy/parser.tab.rb' => 'lib/puffy/parser.y' do
29
- `racc -S lib/puffy/parser.y`
31
+ `racc --embedded --frozen --output-status lib/puffy/parser.y`
30
32
  end
data/lib/core_ext.rb CHANGED
@@ -59,15 +59,13 @@ end
59
59
 
60
60
  class Array # :nodoc:
61
61
  def deep_dup
62
- array = []
63
- each do |value|
64
- array << if value.respond_to?(:deep_dup)
65
- value.deep_dup
66
- else
67
- value.dup
68
- end
62
+ map do |value|
63
+ if value.respond_to?(:deep_dup)
64
+ value.deep_dup
65
+ else
66
+ value.dup
67
+ end
69
68
  end
70
- array
71
69
  end
72
70
  end
73
71
 
@@ -106,11 +106,19 @@ module Puffy
106
106
  end
107
107
 
108
108
  def input_filter_rules(rules)
109
- rules.select { |r| r.filter? && r.in? }
109
+ rules.select { |r| r.filter? && r.in? }.map do |rule|
110
+ dup = rule.dup
111
+ dup.dir = :in
112
+ dup
113
+ end
110
114
  end
111
115
 
112
116
  def output_filter_rules(rules)
113
- rules.select { |r| r.filter? && r.out? }
117
+ rules.select { |r| r.filter? && r.out? }.map do |rule|
118
+ dup = rule.dup
119
+ dup.dir = :out
120
+ dup
121
+ end
114
122
  end
115
123
  end
116
124
 
@@ -116,13 +116,21 @@ module Puffy
116
116
  def emit_rdr_to(rule)
117
117
  return unless rule.rdr?
118
118
 
119
- keyword = Puffy::Formatters::Base.loopback_addresses.include?(rule.rdr_to_host) ? 'divert-to' : 'rdr-to'
119
+ keyword = rdr_to_keyword(rule)
120
120
  destination = rule.rdr_to_host || loopback_address(rule.af)
121
121
  raise 'Unspecified address family' if destination.nil?
122
122
 
123
123
  emit_endpoint_specification(keyword, destination, rule.rdr_to_port)
124
124
  end
125
125
 
126
+ def rdr_to_keyword(rule)
127
+ if Puffy::Formatters::Base.loopback_addresses.include?(rule.rdr_to_host)
128
+ 'divert-to'
129
+ else
130
+ 'rdr-to'
131
+ end
132
+ end
133
+
126
134
  def emit_nat_to(rule)
127
135
  "nat-to #{emit_address(rule.nat_to)}" if rule.nat_to
128
136
  end