diff --git a/plugins/common/aws/credentials.go b/plugins/common/aws/credentials.go index b29f1bf51..8d2c36b6e 100644 --- a/plugins/common/aws/credentials.go +++ b/plugins/common/aws/credentials.go @@ -2,6 +2,7 @@ package aws import ( "context" + awsV2 "github.com/aws/aws-sdk-go-v2/aws" configV2 "github.com/aws/aws-sdk-go-v2/config" credentialsV2 "github.com/aws/aws-sdk-go-v2/credentials" @@ -60,11 +61,16 @@ func (c *CredentialConfig) configWithAssumeCredentials() (awsV2.Config, error) { var provider awsV2.CredentialsProvider stsService := sts.NewFromConfig(defaultConfig) if c.WebIdentityTokenFile != "" { - provider = stscredsV2.NewWebIdentityRoleProvider(stsService, c.RoleARN, stscredsV2.IdentityTokenFile(c.WebIdentityTokenFile), func(opts *stscredsV2.WebIdentityRoleOptions) { - if c.RoleSessionName != "" { - opts.RoleSessionName = c.RoleSessionName - } - }) + provider = stscredsV2.NewWebIdentityRoleProvider( + stsService, + c.RoleARN, + stscredsV2.IdentityTokenFile(c.WebIdentityTokenFile), + func(opts *stscredsV2.WebIdentityRoleOptions) { + if c.RoleSessionName != "" { + opts.RoleSessionName = c.RoleSessionName + } + }, + ) } else { provider = stscredsV2.NewAssumeRoleProvider(stsService, c.RoleARN, func(opts *stscredsV2.AssumeRoleOptions) { if c.RoleSessionName != "" { diff --git a/plugins/common/opcua/opcua_util.go b/plugins/common/opcua/opcua_util.go index 1cc282aa6..b2769d775 100644 --- a/plugins/common/opcua/opcua_util.go +++ b/plugins/common/opcua/opcua_util.go @@ -67,7 +67,8 @@ func generateCert(host string, rsaBits int, certFile, keyFile string, dur time.D NotBefore: notBefore, NotAfter: notAfter, - KeyUsage: x509.KeyUsageContentCommitment | x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageDataEncipherment | x509.KeyUsageCertSign, + KeyUsage: x509.KeyUsageContentCommitment | x509.KeyUsageKeyEncipherment | + x509.KeyUsageDigitalSignature | x509.KeyUsageDataEncipherment | x509.KeyUsageCertSign, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}, BasicConstraintsValid: true, } @@ -191,7 +192,8 @@ func (o *OpcUAClient) generateClientOpts(endpoints []*ua.EndpointDescription) ([ case strings.HasPrefix(policy, ua.SecurityPolicyURIPrefix): secPolicy = policy policy = "" - case policy == "None" || policy == "Basic128Rsa15" || policy == "Basic256" || policy == "Basic256Sha256" || policy == "Aes128_Sha256_RsaOaep" || policy == "Aes256_Sha256_RsaPss": + case policy == "None" || policy == "Basic128Rsa15" || policy == "Basic256" || policy == "Basic256Sha256" || + policy == "Aes128_Sha256_RsaOaep" || policy == "Aes256_Sha256_RsaPss": secPolicy = ua.SecurityPolicyURIPrefix + policy policy = "" default: @@ -261,7 +263,11 @@ func (o *OpcUAClient) generateClientOpts(endpoints []*ua.EndpointDescription) ([ o.Log.Debugf("Evaluating endpoint %s, policy %s, mode %s, level %d", e.EndpointURL, e.SecurityPolicyURI, e.SecurityMode, e.SecurityLevel) if e.SecurityPolicyURI == secPolicy && e.SecurityMode == secMode && (serverEndpoint == nil || e.SecurityLevel >= serverEndpoint.SecurityLevel) { serverEndpoint = e - o.Log.Debugf("Security policy and mode found. Using server endpoint %s for security. Policy %s", serverEndpoint.EndpointURL, serverEndpoint.SecurityPolicyURI) + o.Log.Debugf( + "Security policy and mode found. Using server endpoint %s for security. Policy %s", + serverEndpoint.EndpointURL, + serverEndpoint.SecurityPolicyURI, + ) } } } diff --git a/plugins/common/shim/example/cmd/main.go b/plugins/common/shim/example/cmd/main.go index 18234ff8c..4a7381239 100644 --- a/plugins/common/shim/example/cmd/main.go +++ b/plugins/common/shim/example/cmd/main.go @@ -13,7 +13,12 @@ import ( ) var pollInterval = flag.Duration("poll_interval", 1*time.Second, "how often to send metrics") -var pollIntervalDisabled = flag.Bool("poll_interval_disabled", false, "set to true to disable polling. You want to use this when you are sending metrics on your own schedule") + +var pollIntervalDisabled = flag.Bool( + "poll_interval_disabled", + false, + "set to true to disable polling. You want to use this when you are sending metrics on your own schedule", +) var configFile = flag.String("config", "", "path to the config file for this plugin") var err error