-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added missing e4 commands #17
Conversation
…. Added missing commands stub
"testing" | ||
|
||
"github.com/teserakt-io/c2/pkg/pb" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spurious line yet could be anchored with all the "github.com/*" imports down below.
"github.com/teserakt-io/c2/pkg/pb" | ||
|
||
"github.com/golang/mock/gomock" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto about the spurious newline.
internal/commands/command_test.go
Outdated
@@ -14,8 +12,8 @@ func TestE4Command(t *testing.T) { | |||
if err != nil { | |||
t.Errorf("Expected no error, got %v", err) | |||
} | |||
if cmdType != e4.Command(0x01) { | |||
t.Errorf("Expected type to be %v, got %v", e4.Command(0x01), cmdType) | |||
if cmdType != 0x01 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if g, w := cmdType, 0x01; g != w {
}
but even better, let's make constants instead of using magic numbers.
func (f *factory) CreateRemoveTopicCommand(topic string) (Command, error) { | ||
cmd, err := e4.CmdRemoveTopic(topic) | ||
if err != nil { | ||
return nil, err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the return e4Command(cmd), err
anchored to the if, since they are now all part of the same logical block so:
func (f *factory) CreateRemoveTopicCommand(topic string) (Command, error) {
cmd, err := e4.CmdRemoveTopic(topic)
if err != nil {
return nil, err
}
return e4Command(cmd), err
}
internal/commands/factory.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spurious newline.
internal/commands/factory.go
Outdated
func (f *factory) CreateSetTopicKeyCommand(topic string, key []byte) (Command, error) { | ||
cmd, err := e4.CmdSetTopicKey(key, topic) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spurious newline.
internal/commands/factory.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spurious newline.
Added missing E4 commands as C2 endpoints, along with commands on the c2cli client for:
RemovePubKey
ResetPubKeys
NewC2Key
Notes on
NewC2Key
Fix #15