refactor function

This commit is contained in:
Maycon Santos
2024-03-12 23:58:16 +01:00
parent c9acd2f880
commit c3a1e1ca2c
7 changed files with 78 additions and 111 deletions
+12
View File
@@ -8,6 +8,7 @@ import (
"google.golang.org/grpc/metadata"
"github.com/netbirdio/netbird/client/internal"
"github.com/netbirdio/netbird/version"
)
@@ -53,6 +54,17 @@ type Info struct {
ServerSSHAllowed bool
}
// GetInfo retrieves and parses the system information
func GetInfo(ctx context.Context, config internal.Config) *Info {
info := getInfo(ctx)
info.RosenpassEnabled = config.RosenpassEnabled
info.RosenpassPermissive = config.RosenpassPermissive
if config.ServerSSHAllowed != nil {
info.ServerSSHAllowed = *config.ServerSSHAllowed
}
return info
}
// extractUserAgent extracts Netbird's agent (client) name and version from the outgoing context
func extractUserAgent(ctx context.Context) string {
md, hasMeta := metadata.FromOutgoingContext(ctx)