Documentation ¶
Index ¶
- func CheckC2Online(addr string, grpcPort int, httpPort int) bool
- func GRPCApi(ctx context.Context, resChan chan<- TestResult, grpcClient pb.C2Client)
- func GenerateID() ([]byte, error)
- func GenerateKey() ([]byte, error)
- func GenerateName() (string, error)
- func GenerateTopic() (string, error)
- func GetRandomDBName() string
- func HTTPApi(resChan chan<- TestResult, httpClient *http.Client, host string)
- func NewTestingGRPCClient(relativeCertPath string, serverAddr string) (pb.C2Client, func() error, error)
- func NewTestingHTTPClient() *http.Client
- type Server
- type TestClient
- type TestResult
- type TestTopic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckC2Online ¶
CheckC2Online is a quick function to wait until the C2 is online It does this by defining the C2 online as when both GRPC and HTTP APIs are up and accepting connections. TODO: We might want to formally define some way to deduce if the C2 is loaded, for example by a GRPC request So that all services and any backend initialization is ready.
func GRPCApi ¶
func GRPCApi(ctx context.Context, resChan chan<- TestResult, grpcClient pb.C2Client)
GRPCApi tests the GRPC api of the C2
func GenerateID ¶
GenerateID generates a random ID that is e4.IDLen bytes in length, using a CSPRNG
func GenerateKey ¶
GenerateKey generates a random key that is e4.KeyLen bytes in length, using a CSPRNG
func GenerateName ¶
GenerateName generates a random name beginning clientname-%s it is used to make random-looking names for devices for test purposes.
func GetRandomDBName ¶
func GetRandomDBName() string
GetRandomDBName returns a random database filepath to be used with sqlite driver
func HTTPApi ¶
func HTTPApi(resChan chan<- TestResult, httpClient *http.Client, host string)
HTTPApi tests the http api of the C2
func NewTestingGRPCClient ¶
func NewTestingGRPCClient(relativeCertPath string, serverAddr string) (pb.C2Client, func() error, error)
NewTestingGRPCClient returns a new GRPC client to use for testing
func NewTestingHTTPClient ¶
NewTestingHTTPClient Create a new http client for testing
Types ¶
type TestClient ¶
TestClient provides a representation of an id-key pair.
func NewTestClient ¶
func NewTestClient() (*TestClient, error)
NewTestClient generates a new TestClient
func NewTestClientWithoutName ¶
func NewTestClientWithoutName() (*TestClient, error)
NewTestClientWithoutName generates a new TestClient without name
type TestResult ¶
TestResult reports a test outcome for nice display
func (TestResult) Print ¶
func (result TestResult) Print(w io.Writer)
Print will write the TestResult to given writer