Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Feat/global vpn#316

Merged
nxtcoder17 merged 6 commits into
mainfrom
feat/global-vpn
Apr 29, 2024
Merged

Feat/global vpn#316
nxtcoder17 merged 6 commits into
mainfrom
feat/global-vpn

Conversation

@nxtcoder17
Copy link
Copy Markdown
Member

GlobalVPN implementation

enabling service communication across clusters

GlobalVPNDevice

enabling wireguard device 2-way communication across all the clusters, and other devices in a globalVPN

- global VPN devices incremental IP generation
- allows provisions for reclaiming freed cluster subnets, and device IPs
- default allocation, allows for 8K Service IPs, per cluster, and
  reserves 40K IPs for kloudlite devices/vm/remote-IDEs etc.
- also ensures Devices as peers for GlobalVPNConnections, ensuring 2way
  communication
@nxtcoder17 nxtcoder17 requested a review from karthik1729 as a code owner April 29, 2024 05:56
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @nxtcoder17 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 6 issues found
  • 🟢 Security: all looks good
  • 🟡 Testing: 2 issues found
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@@ -0,0 +1,383 @@
package domain
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Consider adding package documentation

It's a good practice to provide a package-level comment explaining the purpose and scope of the package.

Suggested change
package domain
// Package domain defines the domain layer logic for global VPN cluster connections.
// It encapsulates the core business logic and rules associated with VPN connections.
package domain

@@ -0,0 +1,283 @@
package domain
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Add package documentation for clarity

Providing a brief overview of the package's functionality can help maintainers and new developers understand its role within the project.

Suggested change
package domain
// Package domain defines the domain layer logic for global VPN devices.
// It encapsulates the core business rules and entities involved in managing
// VPN devices within the infrastructure.
package domain


return ipAddr, nil
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Review error handling strategy

Ensure that errors from external libraries or systems are handled gracefully, possibly adding retries or more descriptive error messages.

@@ -0,0 +1,147 @@
package domain
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Add documentation for the 'domain' package

A top-level comment explaining the purpose of the package helps others understand its use and scope more quickly.

Suggested change
package domain
// Package domain defines the domain layer logic for global VPN configurations.
// It encapsulates the core business rules and entities involved in the VPN management.
package domain

Comment on lines +1 to +10
package domain

import (
"math"

iamT "github.com/kloudlite/api/apps/iam/types"
"github.com/kloudlite/api/apps/infra/internal/entities"
fc "github.com/kloudlite/api/apps/infra/internal/entities/field-constants"
"github.com/kloudlite/api/common"
"github.com/kloudlite/api/common/fields"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (testing): Missing integration tests for GlobalVPN domain logic

Integration tests are needed to validate the interactions between the GlobalVPN domain logic and the database, especially for the create, update, and delete operations to ensure data integrity and error handling.

Comment thread pkg/wgutils/keys.go
Comment on lines +1 to +10
package wgutils

import (
"github.com/kloudlite/api/pkg/errors"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)

func GenerateKeyPair() (privateKey string, publicKey string, err error) {
key, err := wgtypes.GenerateKey()
if err != nil {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (testing): Missing unit tests for key generation utility

Add unit tests for GenerateKeyPair to ensure that the keys generated are valid and meet the expected format and security standards.

@nxtcoder17 nxtcoder17 merged commit ba34621 into main Apr 29, 2024
@nxtcoder17 nxtcoder17 deleted the feat/global-vpn branch April 29, 2024 08:10
abdheshnayak pushed a commit that referenced this pull request Nov 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant