Refactoring (#327)

* chore: enable more linters and fix linter issues

* ci: enable linter checks on all branches and disable recurring checks

recurring linter checks don't make that much sense. The code & linter checks should not change on their own over night ;)

* chore: update packages

* Revert "chore: update packages"

This reverts commit 30250bf28c4b39e9e5b3af012a4e28ab036bf9af.

* chore: manually upgrade some packages
This commit is contained in:
Florian Ritterhoff
2023-03-07 01:49:06 +02:00
committed by GitHub
parent 1c4e1e55e4
commit 34344b1b35
22 changed files with 164 additions and 90 deletions
+2 -1
View File
@@ -1,8 +1,9 @@
package acmedns
import (
"github.com/google/uuid"
"net"
"github.com/google/uuid"
)
// Check if IP belongs to an allowed net
+1
View File
@@ -2,6 +2,7 @@ package acmedns
import (
"database/sql"
"github.com/google/uuid"
)
+2 -1
View File
@@ -2,9 +2,10 @@ package acmedns
import (
"crypto/rand"
"golang.org/x/crypto/bcrypt"
"math/big"
"regexp"
"golang.org/x/crypto/bcrypt"
)
func sanitizeIPv6addr(s string) string {
+4 -3
View File
@@ -1,12 +1,13 @@
package acmedns
import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"golang.org/x/crypto/bcrypt"
"os"
"syscall"
"testing"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"golang.org/x/crypto/bcrypt"
)
func fakeConfig() AcmeDnsConfig {
+2 -2
View File
@@ -102,7 +102,7 @@ func TestApiRegister(t *testing.T) {
NotContainsKey("error")
allowfrom := map[string][]interface{}{
"allowfrom": []interface{}{"123.123.123.123/32",
"allowfrom": {"123.123.123.123/32",
"2001:db8:a0b:12f0::1/32",
"[::1]/64",
},
@@ -140,7 +140,7 @@ func TestApiRegisterBadAllowFrom(t *testing.T) {
for _, v := range invalidVals {
allowfrom := map[string][]interface{}{
"allowfrom": []interface{}{v}}
"allowfrom": {v}}
response := e.POST("/register").
WithJSON(allowfrom).
+2 -1
View File
@@ -4,11 +4,12 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/acme-dns/acme-dns/pkg/acmedns"
"net"
"net/http"
"github.com/julienschmidt/httprouter"
"github.com/acme-dns/acme-dns/pkg/acmedns"
)
type key int
+2 -1
View File
@@ -2,9 +2,10 @@ package api
import (
"context"
"github.com/acme-dns/acme-dns/pkg/acmedns"
"github.com/mholt/acmez/acme"
"github.com/acme-dns/acme-dns/pkg/acmedns"
)
// ChallengeProvider implements go-acme/lego Provider interface which is used for ACME DNS challenge handling
+2 -1
View File
@@ -6,8 +6,9 @@ import (
"io"
"net/http"
"github.com/acme-dns/acme-dns/pkg/acmedns"
"github.com/julienschmidt/httprouter"
"github.com/acme-dns/acme-dns/pkg/acmedns"
)
// RegResponse is a struct for registration response JSON
+4 -2
View File
@@ -2,11 +2,13 @@ package api
import (
"fmt"
"github.com/acme-dns/acme-dns/pkg/acmedns"
"github.com/google/uuid"
"regexp"
"strings"
"unicode/utf8"
"github.com/google/uuid"
"github.com/acme-dns/acme-dns/pkg/acmedns"
)
func jsonError(message string) []byte {
+2 -1
View File
@@ -1,9 +1,10 @@
package api
import (
"github.com/acme-dns/acme-dns/pkg/acmedns"
"testing"
"github.com/acme-dns/acme-dns/pkg/acmedns"
"github.com/google/uuid"
)
+4 -2
View File
@@ -10,12 +10,14 @@ import (
"sync"
"time"
"github.com/acme-dns/acme-dns/pkg/acmedns"
_ "github.com/glebarez/go-sqlite"
"github.com/google/uuid"
_ "github.com/lib/pq"
"github.com/google/uuid"
"go.uber.org/zap"
"golang.org/x/crypto/bcrypt"
"github.com/acme-dns/acme-dns/pkg/acmedns"
)
type acmednsdb struct {
+4 -2
View File
@@ -4,10 +4,12 @@ import (
"database/sql"
"database/sql/driver"
"errors"
"github.com/acme-dns/acme-dns/pkg/acmedns"
"testing"
"github.com/erikstmartin/go-testdb"
"go.uber.org/zap"
"testing"
"github.com/acme-dns/acme-dns/pkg/acmedns"
)
type testResult struct {
+6 -4
View File
@@ -5,14 +5,16 @@ import (
"database/sql/driver"
"errors"
"fmt"
"github.com/acme-dns/acme-dns/pkg/acmedns"
"github.com/acme-dns/acme-dns/pkg/database"
"sync"
"testing"
"github.com/erikstmartin/go-testdb"
"github.com/miekg/dns"
"go.uber.org/zap"
"go.uber.org/zap/zaptest/observer"
"sync"
"testing"
"github.com/acme-dns/acme-dns/pkg/acmedns"
"github.com/acme-dns/acme-dns/pkg/database"
)
type resolver struct {
+2 -1
View File
@@ -2,8 +2,9 @@ package nameserver
import (
"fmt"
"github.com/miekg/dns"
"strings"
"github.com/miekg/dns"
)
func (n *Nameserver) handleRequest(w dns.ResponseWriter, r *dns.Msg) {
+5 -3
View File
@@ -1,11 +1,13 @@
package nameserver
import (
"github.com/acme-dns/acme-dns/pkg/acmedns"
"github.com/miekg/dns"
"go.uber.org/zap"
"strings"
"sync"
"github.com/miekg/dns"
"go.uber.org/zap"
"github.com/acme-dns/acme-dns/pkg/acmedns"
)
// Records is a slice of ResourceRecords
+2 -1
View File
@@ -2,9 +2,10 @@ package nameserver
import (
"fmt"
"github.com/miekg/dns"
"strings"
"time"
"github.com/miekg/dns"
)
// ParseRecords parses a slice of DNS record string