diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 4e584ecc2..b23baf031 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -10,6 +10,18 @@ concurrency: cancel-in-progress: true jobs: + codespell: + name: codespell + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: codespell + uses: codespell-project/actions-codespell@v2 + with: + ignore_words_list: erro,clienta + skip: go.mod,go.sum + only_warn: 1 golangci: strategy: fail-fast: false diff --git a/client/internal/acl/manager_test.go b/client/internal/acl/manager_test.go index 518e895cf..25de2a57f 100644 --- a/client/internal/acl/manager_test.go +++ b/client/internal/acl/manager_test.go @@ -281,7 +281,7 @@ func TestDefaultManagerSquashRulesNoAffect(t *testing.T) { manager := &DefaultManager{} if rules, _ := manager.squashAcceptRules(networkMap); len(rules) != len(networkMap.FirewallRules) { - t.Errorf("we should got same amount of rules as intput, got %v", len(rules)) + t.Errorf("we should get the same amount of rules as output, got %v", len(rules)) } } diff --git a/client/internal/dns/server_test.go b/client/internal/dns/server_test.go index cd7932d07..51cc9c8c4 100644 --- a/client/internal/dns/server_test.go +++ b/client/internal/dns/server_test.go @@ -339,7 +339,7 @@ func TestDNSFakeResolverHandleUpdates(t *testing.T) { err = wgIface.Create() if err != nil { - t.Errorf("crate and init wireguard interface: %v", err) + t.Errorf("create and init wireguard interface: %v", err) return } defer func() { @@ -789,7 +789,7 @@ func createWgInterfaceWithBind(t *testing.T) (*iface.WGIface, error) { err = wgIface.Create() if err != nil { - t.Fatalf("crate and init wireguard interface: %v", err) + t.Fatalf("create and init wireguard interface: %v", err) return nil, err } diff --git a/client/internal/ebpf/ebpf/manager_linux_test.go b/client/internal/ebpf/ebpf/manager_linux_test.go index 956499e5b..5664a4565 100644 --- a/client/internal/ebpf/ebpf/manager_linux_test.go +++ b/client/internal/ebpf/ebpf/manager_linux_test.go @@ -8,12 +8,12 @@ func TestManager_setFeatureFlag(t *testing.T) { mgr := GeneralManager{} mgr.setFeatureFlag(featureFlagWGProxy) if mgr.featureFlags != 1 { - t.Errorf("invalid faeture state") + t.Errorf("invalid feature state") } mgr.setFeatureFlag(featureFlagDnsForwarder) if mgr.featureFlags != 3 { - t.Errorf("invalid faeture state") + t.Errorf("invalid feature state") } } @@ -27,7 +27,7 @@ func TestManager_unsetFeatureFlag(t *testing.T) { t.Errorf("unexpected error: %s", err) } if mgr.featureFlags != 2 { - t.Errorf("invalid faeture state, expected: %d, got: %d", 2, mgr.featureFlags) + t.Errorf("invalid feature state, expected: %d, got: %d", 2, mgr.featureFlags) } err = mgr.unsetFeatureFlag(featureFlagDnsForwarder) @@ -35,6 +35,6 @@ func TestManager_unsetFeatureFlag(t *testing.T) { t.Errorf("unexpected error: %s", err) } if mgr.featureFlags != 0 { - t.Errorf("invalid faeture state, expected: %d, got: %d", 0, mgr.featureFlags) + t.Errorf("invalid feature state, expected: %d, got: %d", 0, mgr.featureFlags) } } diff --git a/client/internal/peer/conn.go b/client/internal/peer/conn.go index 9247ed3c5..442f5fe27 100644 --- a/client/internal/peer/conn.go +++ b/client/internal/peer/conn.go @@ -242,7 +242,7 @@ func (conn *Conn) Open() error { } err := conn.statusRecorder.UpdatePeerState(peerState) if err != nil { - log.Warnf("erro while updating the state of peer %s,err: %v", conn.config.Key, err) + log.Warnf("error while updating the state of peer %s,err: %v", conn.config.Key, err) } defer func() { @@ -301,7 +301,7 @@ func (conn *Conn) Open() error { } err = conn.statusRecorder.UpdatePeerState(peerState) if err != nil { - log.Warnf("erro while updating the state of peer %s,err: %v", conn.config.Key, err) + log.Warnf("error while updating the state of peer %s,err: %v", conn.config.Key, err) } err = conn.agent.GatherCandidates() diff --git a/client/ssh/util.go b/client/ssh/util.go index 8ecb77c93..cf5f1396e 100644 --- a/client/ssh/util.go +++ b/client/ssh/util.go @@ -9,9 +9,10 @@ import ( "crypto/x509" "encoding/pem" "fmt" + "strings" + "golang.org/x/crypto/ed25519" gossh "golang.org/x/crypto/ssh" - "strings" ) // KeyType is a type of SSH key @@ -42,7 +43,7 @@ func GeneratePrivateKey(keyType KeyType) ([]byte, error) { case RSA: key, err = rsa.GenerateKey(rand.Reader, RSAKeySize) default: - return nil, fmt.Errorf("unsupported ket type %s", keyType) + return nil, fmt.Errorf("unsupported key type %s", keyType) } if err != nil { return nil, err diff --git a/dns/dns.go b/dns/dns.go index 16ebd1d96..b58b79b53 100644 --- a/dns/dns.go +++ b/dns/dns.go @@ -4,11 +4,12 @@ package dns import ( "fmt" - "github.com/miekg/dns" - "golang.org/x/net/idna" "net" "regexp" "strings" + + "github.com/miekg/dns" + "golang.org/x/net/idna" ) const ( @@ -95,7 +96,7 @@ func GetParsedDomainLabel(name string) (string, error) { rawLabel := labels[0] ascii, err := idna.Punycode.ToASCII(rawLabel) if err != nil { - return "", fmt.Errorf("unable to convert host lavel to ASCII, error: %v", err) + return "", fmt.Errorf("unable to convert host label to ASCII, error: %v", err) } invalidHostMatcher := regexp.MustCompile(invalidHostLabel) diff --git a/iface/tun_adapter.go b/iface/tun_adapter.go index da0b1695b..c10eb3d19 100644 --- a/iface/tun_adapter.go +++ b/iface/tun_adapter.go @@ -1,6 +1,6 @@ package iface -// TunAdapter is an interface for create tun device from externel service +// TunAdapter is an interface for create tun device from external service type TunAdapter interface { ConfigureInterface(address string, mtu int, dns string, searchDomains string, routes string) (int, error) UpdateAddr(address string) error diff --git a/infrastructure_files/configure.sh b/infrastructure_files/configure.sh index 6d2902816..1f70584f3 100755 --- a/infrastructure_files/configure.sh +++ b/infrastructure_files/configure.sh @@ -36,7 +36,7 @@ fi if [[ "x-$NETBIRD_DOMAIN" == "x-" ]]; then echo NETBIRD_DOMAIN is not set, please update your setup.env file - echo If you are migrating from old versions, you migh need to update your variables prefixes from + echo If you are migrating from old versions, you might need to update your variables prefixes from echo WIRETRUSTEE_.. TO NETBIRD_ exit 1 fi diff --git a/infrastructure_files/getting-started-with-zitadel.sh b/infrastructure_files/getting-started-with-zitadel.sh index d00c2719c..67d16e1e2 100644 --- a/infrastructure_files/getting-started-with-zitadel.sh +++ b/infrastructure_files/getting-started-with-zitadel.sh @@ -387,7 +387,7 @@ check_nb_domain() { if [ "$DOMAIN" == "netbird.example.com" ]; then echo "The NETBIRD_DOMAIN cannot be netbird.example.com" > /dev/stderr - retrun 1 + return 1 fi return 0 } diff --git a/infrastructure_files/turnserver.conf.tmpl b/infrastructure_files/turnserver.conf.tmpl index 9b31cb511..1dc38e62d 100644 --- a/infrastructure_files/turnserver.conf.tmpl +++ b/infrastructure_files/turnserver.conf.tmpl @@ -677,7 +677,7 @@ no-cli # #cli-password=$5$79a316b350311570$81df9cfb9af7f5e5a76eada31e7097b663a0670f99a3c07ded3f1c8e59c5658a # -# Or unsecure form for the same password: +# Or insecure form for the same password: # # cli-password=CHANGE_ME diff --git a/management/server/account_test.go b/management/server/account_test.go index c8a8a5dc9..0d707bde9 100644 --- a/management/server/account_test.go +++ b/management/server/account_test.go @@ -251,7 +251,7 @@ func TestAccountManager_GetOrCreateAccountByUser(t *testing.T) { } if account != nil && account.Users[userID] == nil { - t.Fatalf("expected to create an account for a user %s but no user was found after creation udner the account %s", userID, account.Id) + t.Fatalf("expected to create an account for a user %s but no user was found after creation under the account %s", userID, account.Id) return } @@ -626,7 +626,7 @@ func TestAccountManager_PrivateAccount(t *testing.T) { } if account != nil && account.Users[userId] == nil { - t.Fatalf("expected to create an account for a user %s but no user was found after creation udner the account %s", userId, account.Id) + t.Fatalf("expected to create an account for a user %s but no user was found after creation under the account %s", userId, account.Id) } } @@ -1385,7 +1385,7 @@ func TestAccount_Copy(t *testing.T) { if err != nil { t.Fatal(err) } - account.Peers["peer1"].Status.Connected = false // we change original object to confirm that copy wont change + account.Peers["peer1"].Status.Connected = false // we change original object to confirm that copy won't change accCopyBytes, err := json.Marshal(accountCopy) if err != nil { t.Fatal(err) diff --git a/management/server/jwtclaims/extractor_test.go b/management/server/jwtclaims/extractor_test.go index f7eeb82e5..f2cbb1ebe 100644 --- a/management/server/jwtclaims/extractor_test.go +++ b/management/server/jwtclaims/extractor_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" ) -func newTestRequestWithJWT(t *testing.T, claims AuthorizationClaims, audiance string) *http.Request { +func newTestRequestWithJWT(t *testing.T, claims AuthorizationClaims, audience string) *http.Request { const layout = "2006-01-02T15:04:05.999Z" claimMaps := jwt.MapClaims{} @@ -18,16 +18,16 @@ func newTestRequestWithJWT(t *testing.T, claims AuthorizationClaims, audiance st claimMaps[UserIDClaim] = claims.UserId } if claims.AccountId != "" { - claimMaps[audiance+AccountIDSuffix] = claims.AccountId + claimMaps[audience+AccountIDSuffix] = claims.AccountId } if claims.Domain != "" { - claimMaps[audiance+DomainIDSuffix] = claims.Domain + claimMaps[audience+DomainIDSuffix] = claims.Domain } if claims.DomainCategory != "" { - claimMaps[audiance+DomainCategorySuffix] = claims.DomainCategory + claimMaps[audience+DomainCategorySuffix] = claims.DomainCategory } if claims.LastLogin != (time.Time{}) { - claimMaps[audiance+LastLoginSuffix] = claims.LastLogin.Format(layout) + claimMaps[audience+LastLoginSuffix] = claims.LastLogin.Format(layout) } token := jwt.NewWithClaims(jwt.SigningMethodHS256, claimMaps) r, err := http.NewRequest(http.MethodGet, "http://localhost", nil) diff --git a/sharedsock/sock_linux.go b/sharedsock/sock_linux.go index c9e35dfa2..b823bb508 100644 --- a/sharedsock/sock_linux.go +++ b/sharedsock/sock_linux.go @@ -262,7 +262,7 @@ func (s *SharedSocket) ReadFrom(b []byte) (n int, addr net.Addr, err error) { return int(udp.Length), remoteAddr, nil } -// WriteTo builds a UDP packet and writes it using the specific IP version writter +// WriteTo builds a UDP packet and writes it using the specific IP version writer func (s *SharedSocket) WriteTo(buf []byte, rAddr net.Addr) (n int, err error) { rUDPAddr, ok := rAddr.(*net.UDPAddr) if !ok { diff --git a/signal/client/grpc.go b/signal/client/grpc.go index fef443173..9f70234e9 100644 --- a/signal/client/grpc.go +++ b/signal/client/grpc.go @@ -260,7 +260,7 @@ func (c *GrpcClient) SendToStream(msg *proto.EncryptedMessage) error { return fmt.Errorf("no connection to signal") } if c.stream == nil { - return fmt.Errorf("connection to the Signal Exchnage has not been established yet. Please call GrpcClient.Receive before sending messages") + return fmt.Errorf("connection to the Signal Exchange has not been established yet. Please call GrpcClient.Receive before sending messages") } err := c.stream.Send(msg)