Skip to content

Commit 8ed75e4

Browse files
authored
Release/0.9.6 (#141)
* Bump up APIFW ver to 0.9.6 * Update the pool * Upgrade dependencies * Bump up Go, alpine, trivy versions
1 parent 7e3070f commit 8ed75e4

37 files changed

Lines changed: 1658 additions & 628 deletions

.github/workflows/binaries.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
needs:
5252
- draft-release
5353
env:
54-
X_GO_DISTRIBUTION: "https://go.dev/dl/go1.24.11.linux-amd64.tar.gz"
54+
X_GO_DISTRIBUTION: "https://go.dev/dl/go1.25.8.linux-amd64.tar.gz"
5555
APIFIREWALL_NAMESPACE: "github.com/wallarm/api-firewall"
5656
strategy:
5757
matrix:
@@ -162,7 +162,7 @@ jobs:
162162
needs:
163163
- draft-release
164164
env:
165-
X_GO_VERSION: "1.24.11"
165+
X_GO_VERSION: "1.25.8"
166166
APIFIREWALL_NAMESPACE: "github.com/wallarm/api-firewall"
167167
strategy:
168168
matrix:
@@ -181,7 +181,7 @@ jobs:
181181
-
182182
uses: addnab/docker-run-action@v3
183183
with:
184-
image: golang:${{ env.X_GO_VERSION }}-alpine3.22
184+
image: golang:${{ env.X_GO_VERSION }}-alpine3.23
185185
options: >
186186
--volume ${{ github.workspace }}:/build
187187
--workdir /build
@@ -272,19 +272,19 @@ jobs:
272272
include:
273273
- arch: armv6
274274
distro: bookworm
275-
go_distribution: https://go.dev/dl/go1.24.11.linux-armv6l.tar.gz
275+
go_distribution: https://go.dev/dl/go1.25.8.linux-armv6l.tar.gz
276276
artifact: armv6-libc
277277
- arch: aarch64
278278
distro: bookworm
279-
go_distribution: https://go.dev/dl/go1.24.11.linux-arm64.tar.gz
279+
go_distribution: https://go.dev/dl/go1.25.8.linux-arm64.tar.gz
280280
artifact: arm64-libc
281281
- arch: armv6
282282
distro: alpine_latest
283-
go_distribution: https://go.dev/dl/go1.24.11.linux-armv6l.tar.gz
283+
go_distribution: https://go.dev/dl/go1.25.8.linux-armv6l.tar.gz
284284
artifact: armv6-musl
285285
- arch: aarch64
286286
distro: alpine_latest
287-
go_distribution: https://go.dev/dl/go1.24.11.linux-arm64.tar.gz
287+
go_distribution: https://go.dev/dl/go1.25.8.linux-arm64.tar.gz
288288
artifact: arm64-musl
289289
steps:
290290
- uses: actions/checkout@v4

.github/workflows/trivy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
docker build -t wallarm/api-firewall:${{ github.sha }} .
3131
3232
- name: Run Trivy vulnerability scanner
33-
uses: aquasecurity/trivy-action@0.28.0
33+
uses: aquasecurity/trivy-action@v0.35.0
3434
with:
3535
image-ref: 'wallarm/api-firewall:${{ github.sha }}'
3636
format: 'sarif'

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ vendor/
1616
.DS_Store
1717
.idea/
1818
/dev/
19+
20+
# Claude Code configuration
21+
CLAUDE.md
22+
.claude/

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.24-alpine3.22 AS build
1+
FROM golang:1.25-alpine3.23 AS build
22

33
ARG APIFIREWALL_NAMESPACE
44
ARG APIFIREWALL_VERSION
@@ -24,7 +24,7 @@ RUN go mod download -x && \
2424
# Smoke test
2525
RUN ./api-firewall -v
2626

27-
FROM alpine:3.22 AS composer
27+
FROM alpine:3.23 AS composer
2828

2929
WORKDIR /output
3030

@@ -34,7 +34,7 @@ COPY docker-entrypoint.sh ./usr/local/bin/docker-entrypoint.sh
3434
RUN chmod 755 ./usr/local/bin/* && \
3535
chown root:root ./usr/local/bin/*
3636

37-
FROM alpine:3.22
37+
FROM alpine:3.23
3838

3939
RUN adduser -u 1000 -H -h /opt -D -s /bin/sh api-firewall
4040

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION := 0.9.5
1+
VERSION := 0.9.6
22
NAMESPACE := github.com/wallarm/api-firewall
33

44
.DEFAULT_GOAL := build

cmd/api-firewall/internal/handlers/graphql/run.go

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ import (
2424
const (
2525
logPrefix = "main"
2626

27-
initialPoolCapacity = 100
28-
livenessEndpoint = "/v1/liveness"
29-
readinessEndpoint = "/v1/readiness"
27+
livenessEndpoint = "/v1/liveness"
28+
readinessEndpoint = "/v1/readiness"
3029
)
3130

3231
func Run(logger zerolog.Logger) error {
@@ -113,28 +112,20 @@ func Run(logger zerolog.Logger) error {
113112
}
114113
}
115114

116-
initialCap := initialPoolCapacity
117-
118-
if cfg.Server.ClientPoolCapacity < initialPoolCapacity {
119-
initialCap = 1
120-
}
121-
122-
options := proxy.Options{
123-
InitialPoolCapacity: initialCap,
124-
ClientPoolCapacity: cfg.Server.ClientPoolCapacity,
125-
InsecureConnection: cfg.Server.InsecureConnection,
126-
RootCA: cfg.Server.RootCA,
115+
pool, err := proxy.NewPoolV2(host, &proxy.PoolV2Options{
127116
MaxConnsPerHost: cfg.Server.MaxConnsPerHost,
117+
MaxIdleConnDuration: cfg.Server.MaxIdleConnDuration,
128118
ReadTimeout: cfg.Server.ReadTimeout,
129119
WriteTimeout: cfg.Server.WriteTimeout,
120+
DialTimeout: cfg.Server.DialTimeout,
130121
ReadBufferSize: cfg.Server.ReadBufferSize,
131122
WriteBufferSize: cfg.Server.WriteBufferSize,
132123
MaxResponseBodySize: cfg.Server.MaxResponseBodySize,
133-
DialTimeout: cfg.Server.DialTimeout,
124+
InsecureConnection: cfg.Server.InsecureConnection,
125+
RootCA: cfg.Server.RootCA,
126+
HealthCheckInterval: cfg.Server.HealthCheckInterval,
134127
Logger: logger,
135-
}
136-
137-
pool, err := proxy.NewChanPool(host, &options)
128+
})
138129
if err != nil {
139130
return errors.Wrap(err, "proxy pool init")
140131
}

cmd/api-firewall/internal/handlers/proxy/run.go

Lines changed: 9 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package proxy
22

33
import (
4-
"context"
54
"mime"
6-
"net"
75
"net/url"
86
"os"
97
"os/signal"
@@ -29,9 +27,8 @@ import (
2927
)
3028

3129
const (
32-
initialPoolCapacity = 100
33-
livenessEndpoint = "/v1/liveness"
34-
readinessEndpoint = "/v1/readiness"
30+
livenessEndpoint = "/v1/liveness"
31+
readinessEndpoint = "/v1/readiness"
3532
)
3633

3734
func Run(logger zerolog.Logger) error {
@@ -145,63 +142,20 @@ func Run(logger zerolog.Logger) error {
145142
}
146143
}
147144

148-
initialCap := initialPoolCapacity
149-
150-
if cfg.Server.ClientPoolCapacity < initialPoolCapacity {
151-
initialCap = 1
152-
}
153-
154-
// default DNS resolver
155-
resolver := &net.Resolver{
156-
PreferGo: true,
157-
StrictErrors: false,
158-
}
159-
160-
// configuration of the custom DNS server
161-
if cfg.DNS.Nameserver.Host != "" {
162-
var builder strings.Builder
163-
builder.WriteString(cfg.DNS.Nameserver.Host)
164-
builder.WriteString(":")
165-
builder.WriteString(cfg.DNS.Nameserver.Port)
166-
167-
resolver.Dial = func(ctx context.Context, network, address string) (net.Conn, error) {
168-
d := net.Dialer{
169-
Timeout: cfg.DNS.LookupTimeout,
170-
}
171-
return d.DialContext(ctx, cfg.DNS.Nameserver.Proto, builder.String())
172-
}
173-
}
174-
175-
// init DNS resolver
176-
dnsCacheOptions := proxy.DNSCacheOptions{
177-
UseCache: cfg.DNS.Cache,
178-
Logger: logger,
179-
FetchTimeout: cfg.DNS.FetchTimeout,
180-
LookupTimeout: cfg.DNS.LookupTimeout,
181-
}
182-
183-
dnsResolver, err := proxy.NewDNSResolver(resolver, &dnsCacheOptions)
184-
if err != nil {
185-
return errors.Wrap(err, "DNS cache resolver init")
186-
}
187-
188-
options := proxy.Options{
189-
InitialPoolCapacity: initialCap,
190-
ClientPoolCapacity: cfg.Server.ClientPoolCapacity,
191-
InsecureConnection: cfg.Server.InsecureConnection,
192-
RootCA: cfg.Server.RootCA,
145+
pool, err := proxy.NewPoolV2(host, &proxy.PoolV2Options{
193146
MaxConnsPerHost: cfg.Server.MaxConnsPerHost,
147+
MaxIdleConnDuration: cfg.Server.MaxIdleConnDuration,
194148
ReadTimeout: cfg.Server.ReadTimeout,
195149
WriteTimeout: cfg.Server.WriteTimeout,
150+
DialTimeout: cfg.Server.DialTimeout,
196151
ReadBufferSize: cfg.Server.ReadBufferSize,
197152
WriteBufferSize: cfg.Server.WriteBufferSize,
198153
MaxResponseBodySize: cfg.Server.MaxResponseBodySize,
199-
DialTimeout: cfg.Server.DialTimeout,
200-
DNSConfig: cfg.DNS,
154+
InsecureConnection: cfg.Server.InsecureConnection,
155+
RootCA: cfg.Server.RootCA,
156+
HealthCheckInterval: cfg.Server.HealthCheckInterval,
201157
Logger: logger,
202-
DNSResolver: dnsResolver,
203-
}
204-
pool, err := proxy.NewChanPool(host, &options)
158+
})
205159
if err != nil {
206160
return errors.Wrap(err, "proxy pool init")
207161
}

cmd/api-firewall/tests/main_graphql_bench_test.go

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package tests
33
import (
44
"bytes"
55
"errors"
6-
"net"
76
"net/http"
87
"net/url"
98
"os"
@@ -126,38 +125,14 @@ func BenchmarkGraphQL(b *testing.B) {
126125
}
127126
host := serverURL.Host
128127

129-
initialCap := 100
130-
131-
// default DNS resolver
132-
resolver := &net.Resolver{
133-
PreferGo: true,
134-
StrictErrors: false,
135-
}
136-
137-
// init DNS resolver
138-
dnsCacheOptions := proxy.DNSCacheOptions{
139-
UseCache: false,
140-
Logger: logger,
141-
LookupTimeout: 1000 * time.Millisecond,
142-
}
143-
144-
dnsResolver, err := proxy.NewDNSResolver(resolver, &dnsCacheOptions)
145-
if err != nil {
146-
b.Fatal(err, "DNS cache resolver init")
147-
}
148-
149-
options := proxy.Options{
150-
InitialPoolCapacity: initialCap,
151-
ClientPoolCapacity: 1000,
152-
InsecureConnection: true,
153-
MaxConnsPerHost: 512,
154-
ReadTimeout: 5 * time.Second,
155-
WriteTimeout: 5 * time.Second,
156-
DialTimeout: 5 * time.Second,
157-
DNSResolver: dnsResolver,
158-
Logger: logger,
159-
}
160-
pool, err := proxy.NewChanPool(host, &options)
128+
pool, err := proxy.NewPoolV2(host, &proxy.PoolV2Options{
129+
InsecureConnection: true,
130+
MaxConnsPerHost: 512,
131+
ReadTimeout: 5 * time.Second,
132+
WriteTimeout: 5 * time.Second,
133+
DialTimeout: 5 * time.Second,
134+
Logger: logger,
135+
})
161136
if err != nil {
162137
b.Fatalf("proxy pool init: %v", err)
163138
}

0 commit comments

Comments
 (0)