Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
camdencheek committed Apr 21, 2020
1 parent efa1523 commit db7f1e6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/args/args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ func TestParseArgs(t *testing.T) {
DefaultJMXHost: "test-default-host",
DefaultJMXPort: 9998,
NrJmx: "/usr/bin/nrjmx",
CollectBrokerTopicData: true,
Producers: `[{"name":"producer1", "host":"producerhost","user":"a1","password":"p1","port":9995},{"name":"producer2"}]`,
Consumers: "[]",
TopicMode: "Specific",
TopicList: `["test1", "test2", "test3"]`,
TopicBucket: `1/3`,
Timeout: 1000,
ConsumerOffset: false,
ConsumerGroups: "[]",
ConsumerGroupRegex: ".*",
SaslMechanism: "PLAIN",
SaslUsername: "admin3",
SaslPassword: "secret1",
CollectBrokerTopicData: true,
Producers: `[{"name":"producer1", "host":"producerhost","user":"a1","password":"p1","port":9995},{"name":"producer2"}]`,
Consumers: "[]",
TopicMode: "Specific",
TopicList: `["test1", "test2", "test3"]`,
TopicBucket: `1/3`,
Timeout: 1000,
ConsumerOffset: false,
ConsumerGroups: "[]",
ConsumerGroupRegex: ".*",
SaslMechanism: "PLAIN",
SaslUsername: "admin3",
SaslPassword: "secret1",
}

expectedArgs := &ParsedArguments{
Expand Down
7 changes: 7 additions & 0 deletions src/connection/sasl_scram.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@ import (
"github.com/xdg/scram"
)

// SHA256 is a scram.HashGeneratorFcn
var SHA256 scram.HashGeneratorFcn = func() hash.Hash { return sha256.New() }

// SHA512 is a scram.HashGeneratorFcn
var SHA512 scram.HashGeneratorFcn = func() hash.Hash { return sha512.New() }

// XDGSCRAMClient implements sarama.SCRAMClient
type XDGSCRAMClient struct {
*scram.Client
*scram.ClientConversation
scram.HashGeneratorFcn
}

// Begin is an implementation of sarams.SCRAMClient.Begin()
func (x *XDGSCRAMClient) Begin(userName, password, authzID string) (err error) {
x.Client, err = x.HashGeneratorFcn.NewClient(userName, password, authzID)
if err != nil {
Expand All @@ -26,11 +31,13 @@ func (x *XDGSCRAMClient) Begin(userName, password, authzID string) (err error) {
return nil
}

// Step is an implementation of sarams.SCRAMClient.Step()
func (x *XDGSCRAMClient) Step(challenge string) (response string, err error) {
response, err = x.ClientConversation.Step(challenge)
return
}

// Done is an implementation of sarams.SCRAMClient.Done()
func (x *XDGSCRAMClient) Done() bool {
return x.ClientConversation.Done()
}

0 comments on commit db7f1e6

Please sign in to comment.