mholt / caddy-ratelimit

HTTP rate limiting module for Caddy 2
Apache License 2.0
255 stars 17 forks source link

Can't build 2.5.0 with caddy-ratelimit due to quic errors #9

Closed mdegat01 closed 2 years ago

mdegat01 commented 2 years ago

Made a clean container from the image golang:1.18.1-alpine3.15 and added xcaddy 0.3.0 to it. Then I tried to run the following command:

xcaddy build \
         --with github.com/mholt/caddy-ratelimit \
         --output caddy

It errors out with the following:

2022/04/28 04:21:52 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /go/caddy -ldflags -w -s -trimpath
# github.com/caddyserver/caddy/v2
/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.5.0/listeners.go:187:68: undefined: quic.EarlySession
2022/04/28 04:24:07 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-04-28-0421.740480886
2022/04/28 04:24:07 [FATAL] exit status 2

The complete output of this command can be found here.

One thing I notice looking through it is that it appears getting this package forces an upgrade of github.com/lucas-clemente/quic-go to v0.27.0. And I don't see a downgrade back to v0.26.0 later as this line suggests should happen. I'm not sure why that would be but I know from https://github.com/caddyserver/xcaddy/issues/99 that Caddy v2.5.0 is not compatible with quic v0.27.0 so that seems to be the problem.

francislavoie commented 2 years ago

Oh, yeah. @sylloger, we can't use a module replacement, because module replacements are not looked at when another module is the main module. https://github.com/mholt/caddy-ratelimit/pull/8 introduced an issue.

mholt commented 2 years ago

Updated go.mod and tested with xcaddy that it builds for me successfully :+1:

mdegat01 commented 2 years ago

Just built successfully as well. Thanks!