From aa3b85f00240a4eab748b0f6b24feb24b2753dbd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 25 Feb 2023 00:10:04 +0000 Subject: [PATCH 1/2] build(deps): bump github.com/labstack/echo/v4 from 4.10.1 to 4.10.2 Bumps [github.com/labstack/echo/v4](https://github.com/labstack/echo) from 4.10.1 to 4.10.2. - [Release notes](https://github.com/labstack/echo/releases) - [Changelog](https://github.com/labstack/echo/blob/master/CHANGELOG.md) - [Commits](https://github.com/labstack/echo/compare/v4.10.1...v4.10.2) --- updated-dependencies: - dependency-name: github.com/labstack/echo/v4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b4bd1b6..f3eeb74 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( require ( github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d - github.com/labstack/echo/v4 v4.10.1 + github.com/labstack/echo/v4 v4.10.2 github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect github.com/stretchr/testify v1.8.1 diff --git a/go.sum b/go.sum index b9d69ac..75a4cbc 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ github.com/go-faker/faker/v4 v4.0.0/go.mod h1:uuNc0PSRxF8nMgjGrrrU4Nw5cF30Jc6Kd0 github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/labstack/echo/v4 v4.10.1 h1:rB+D8In9PWjsp1OpHaqK+t04nQv/SBD1IoIcXCg0lpY= -github.com/labstack/echo/v4 v4.10.1/go.mod h1:OEyqf2//K1DFdE57vw2DRgWY0M7s65IVQO2FzvI4J5k= +github.com/labstack/echo/v4 v4.10.2 h1:n1jAhnq/elIFTHr1EYpiYtyKgx4RW9ccVgkqByZaN2M= +github.com/labstack/echo/v4 v4.10.2/go.mod h1:OEyqf2//K1DFdE57vw2DRgWY0M7s65IVQO2FzvI4J5k= github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= From 87be43d95f14cdd4ceeabcf4646dd640e06fd46a Mon Sep 17 00:00:00 2001 From: David Ramiro Date: Sun, 26 Feb 2023 18:42:55 +0100 Subject: [PATCH 2/2] fix: prevent porkbun rate limit --- pkg/porkbun/porkbun.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/porkbun/porkbun.go b/pkg/porkbun/porkbun.go index ab2bcd9..a61b23e 100644 --- a/pkg/porkbun/porkbun.go +++ b/pkg/porkbun/porkbun.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "net/http" + "time" "github.com/davidramiro/frigabun/internal/config" "github.com/davidramiro/frigabun/internal/logger" @@ -53,11 +54,15 @@ func (p *PorkbunDns) AddRecord() *PorkbunUpdateError { queryErr := porkbunRequest.queryRecord(p) + time.Sleep(2 * time.Second) + if queryErr != nil && queryErr.Code == 409 { logger.Log.Info().Msg("record exists, updating") updateErr := porkbunRequest.updateRecord(p) + time.Sleep(2 * time.Second) + if updateErr != nil { logger.Log.Error().Str("err", updateErr.Message).Msg("porkbun rejected updated record") return &PorkbunUpdateError{Code: 400, Message: updateErr.Message} @@ -65,6 +70,9 @@ func (p *PorkbunDns) AddRecord() *PorkbunUpdateError { } else { createErr := porkbunRequest.createRecord(p) + + time.Sleep(2 * time.Second) + if createErr != nil { logger.Log.Error().Str("err", createErr.Message).Msg("porkbun rejected new record") return &PorkbunUpdateError{Code: 400, Message: createErr.Message}