Skip to content

Commit

Permalink
Merge pull request #377 from torsm/sot-migration
Browse files Browse the repository at this point in the history
Fix and format source files and docs
  • Loading branch information
torsm authored Aug 30, 2023
2 parents 661d3f8 + 4c8faeb commit a5862c9
Show file tree
Hide file tree
Showing 68 changed files with 646 additions and 580 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/google/fleetspeak)](https://goreportcard.com/report/github.com/google/fleetspeak)

Fleetspeak is a framework for communicating with a fleet of machines, with a
focus on security monitoring and basic administrative use cases. It is a
focus on security monitoring and basic administrative use cases. It is a
subproject of [GRR](https://github.com/google/grr/blob/master/README.md), and
can be seen as an effort to modularizing and modernizing its communication
mechanism.
Expand All @@ -17,6 +17,7 @@ building out installation processes and otherwise preparing for broader external
use, both as part of GRR and for other uses.

## Getting Started

On linux, assuming a recent version of the go development environment (tested
with 1.9, probably requires at least 1.8) and virtualenv, the following sequence
of commands will build and test this pre-release:
Expand Down Expand Up @@ -54,6 +55,6 @@ Once built, you can take a look at the files and instructions in our
## DISCLAIMER

While the code presented here is in some sense feature complete, much of it is
barely tested or documented, and breaking changes are still possible.
Therefore, please consider this a preview release while the dust settles.
Suggestions and pull requests are very much appreciated.
barely tested or documented, and breaking changes are still possible. Therefore,
please consider this a preview release while the dust settles. Suggestions and
pull requests are very much appreciated.
8 changes: 4 additions & 4 deletions fleetspeak/client-wheel/setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from optparse import OptionParser
from setuptools import setup
from wheel.bdist_wheel import bdist_wheel

import pathlib
import sys

from setuptools import setup
from wheel.bdist_wheel import bdist_wheel


class BdistWheel(bdist_wheel):
user_options = [
('platform-name=', None, 'Platform name to force.'),
("platform-name=", None, "Platform name to force."),
]

def initialize_options(self):
Expand Down
8 changes: 4 additions & 4 deletions fleetspeak/server-wheel/setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from optparse import OptionParser
from setuptools import setup
from wheel.bdist_wheel import bdist_wheel

import pathlib
import sys

from setuptools import setup
from wheel.bdist_wheel import bdist_wheel


class BdistWheel(bdist_wheel):
user_options = [
('platform-name=', None, 'Platform name to force.'),
("platform-name=", None, "Platform name to force."),
]

def initialize_options(self):
Expand Down
2 changes: 1 addition & 1 deletion fleetspeak/src/admin/history/history_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"testing"
"time"

tspb "google.golang.org/protobuf/types/known/timestamppb"
spb "github.com/google/fleetspeak/fleetspeak/src/server/proto/fleetspeak_server"
tspb "google.golang.org/protobuf/types/known/timestamppb"
)

func TestSummary(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions fleetspeak/src/client/channel/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import (
// - Steps 1) and 2) are in little endian byte order.
//
// - An orderly shutdown is to close the connection instead of performing step
// 2. In particular, this means that a valid sequence begins and ends with the
// magic number.
// 2. In particular, this means that a valid sequence begins and ends with the
// magic number.
//
// - Steps 1) and 3) are expected to happen without significant delay.
const (
Expand Down
2 changes: 1 addition & 1 deletion fleetspeak/src/client/channel/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"testing"
"time"

"google.golang.org/protobuf/proto"
fspb "github.com/google/fleetspeak/fleetspeak/src/common/proto/fleetspeak"
"google.golang.org/protobuf/proto"
)

func TestWithLoopback(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fleetspeak/src/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ import (
"testing"
"time"

"google.golang.org/protobuf/proto"
"github.com/google/fleetspeak/fleetspeak/src/client/clienttestutils"
"github.com/google/fleetspeak/fleetspeak/src/client/config"
"github.com/google/fleetspeak/fleetspeak/src/client/service"
"github.com/google/fleetspeak/fleetspeak/src/common"
"github.com/google/fleetspeak/fleetspeak/src/comtesting"
"google.golang.org/protobuf/proto"
anypb "google.golang.org/protobuf/types/known/anypb"

fspb "github.com/google/fleetspeak/fleetspeak/src/common/proto/fleetspeak"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
"time"

log "github.com/golang/glog"
"google.golang.org/protobuf/proto"
"github.com/google/fleetspeak/fleetspeak/src/client/channel"
"github.com/google/fleetspeak/fleetspeak/src/client/clitesting"
"google.golang.org/protobuf/proto"

dspb "github.com/google/fleetspeak/fleetspeak/src/client/daemonservice/proto/fleetspeak_daemonservice"
fspb "github.com/google/fleetspeak/fleetspeak/src/common/proto/fleetspeak"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ syntax = "proto3";

package fleetspeak.daemonservice;

option go_package = "github.com/google/fleetspeak/fleetspeak/src/client/daemonservice/proto/fleetspeak_daemonservice";

import "google/protobuf/duration.proto";

option go_package = "github.com/google/fleetspeak/fleetspeak/src/client/daemonservice/proto/fleetspeak_daemonservice";

// The configuration information expected by daemonservice.Factory in
// ClientServiceConfig.config.
message Config {
Expand Down Expand Up @@ -51,12 +51,12 @@ message Config {
// message_type="StdOutput"
// data=<fleetspeak.daemonservice.StdOutputData>
message StdParams {
string service_name = 1; // Service on the server to forward to. Required.
string service_name = 1; // Service on the server to forward to. Required.

// A message will be sent when we have flush_bytes queued, or when we
// have bytes flush_time_seconds old.
int32 flush_bytes = 2; // Default and maximum value is 1MB.
int32 flush_time_seconds = 3; // Default is 60.
int32 flush_bytes = 2; // Default and maximum value is 1MB.
int32 flush_time_seconds = 3; // Default is 60.
}
StdParams std_params = 11;
}
2 changes: 1 addition & 1 deletion fleetspeak/src/client/https/polling.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import (
"time"

log "github.com/golang/glog"
"google.golang.org/protobuf/proto"
"github.com/google/fleetspeak/fleetspeak/src/client/comms"
"github.com/google/fleetspeak/fleetspeak/src/client/watchdog"
"github.com/google/fleetspeak/fleetspeak/src/common"
"google.golang.org/protobuf/proto"

clpb "github.com/google/fleetspeak/fleetspeak/src/client/proto/fleetspeak_client"
fspb "github.com/google/fleetspeak/fleetspeak/src/common/proto/fleetspeak"
Expand Down
2 changes: 1 addition & 1 deletion fleetspeak/src/client/https/polling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ import (
"github.com/google/fleetspeak/fleetspeak/src/common"
common_util "github.com/google/fleetspeak/fleetspeak/src/comtesting"

anypb "google.golang.org/protobuf/types/known/anypb"
clpb "github.com/google/fleetspeak/fleetspeak/src/client/proto/fleetspeak_client"
fspb "github.com/google/fleetspeak/fleetspeak/src/common/proto/fleetspeak"
anypb "google.golang.org/protobuf/types/known/anypb"
)

func TestCreate(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions fleetspeak/src/client/https/streaming.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,15 @@ func (c *connection) writeLoop(bw *io.PipeWriter) {
log.Errorf("Error creating streaming contact data: %v", err)
return
}

buf, err := proto.Marshal(wcd)
if err != nil {
log.Errorf("Error encoding streaming contact data: %v", err)
return
}
sizeBuf := make([]byte, 0, 16)
sizeBuf = binary.AppendUvarint(sizeBuf, uint64(len(buf)))

log.V(2).Infof("<-Starting write of %d bytes", len(buf))
start := time.Now()
sizeWritten, err := bw.Write(sizeBuf)
Expand Down
2 changes: 1 addition & 1 deletion fleetspeak/src/client/internal/config/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
"time"

log "github.com/golang/glog"
"google.golang.org/protobuf/proto"
"github.com/google/fleetspeak/fleetspeak/src/client/config"
"github.com/google/fleetspeak/fleetspeak/src/common"
"google.golang.org/protobuf/proto"

clpb "github.com/google/fleetspeak/fleetspeak/src/client/proto/fleetspeak_client"
fspb "github.com/google/fleetspeak/fleetspeak/src/common/proto/fleetspeak"
Expand Down
2 changes: 1 addition & 1 deletion fleetspeak/src/client/internal/message/retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"github.com/google/fleetspeak/fleetspeak/src/client/comms"
"github.com/google/fleetspeak/fleetspeak/src/client/service"

anypb "google.golang.org/protobuf/types/known/anypb"
fspb "github.com/google/fleetspeak/fleetspeak/src/common/proto/fleetspeak"
anypb "google.golang.org/protobuf/types/known/anypb"
)

func makeMessages(count, size int) []service.AckMessage {
Expand Down
4 changes: 2 additions & 2 deletions fleetspeak/src/client/proto/fleetspeak_client/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ syntax = "proto3";

package fleetspeak.client;

option go_package = "github.com/google/fleetspeak/fleetspeak/src/client/proto/fleetspeak_client";

import "google/protobuf/any.proto";

option go_package = "github.com/google/fleetspeak/fleetspeak/src/client/proto/fleetspeak_client";

message ByteBlob {
bytes data = 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"os"
"path/filepath"
"strings"

log "github.com/golang/glog"

"github.com/hectane/go-acl/api"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ syntax = "proto3";

package fleetspeak.stdinservice;

option go_package = "github.com/google/fleetspeak/fleetspeak/src/client/stdinservice/proto/fleetspeak_stdinservice";

import "google/protobuf/timestamp.proto";
import "fleetspeak/src/common/proto/fleetspeak_monitoring/resource.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/google/fleetspeak/fleetspeak/src/client/stdinservice/proto/fleetspeak_stdinservice";

message InputMessage {
// The data to be forwarded to the service.
Expand Down
2 changes: 1 addition & 1 deletion fleetspeak/src/client/stdinservice/stdinservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"strings"

log "github.com/golang/glog"
tspb "google.golang.org/protobuf/types/known/timestamppb"
anypb "google.golang.org/protobuf/types/known/anypb"
tspb "google.golang.org/protobuf/types/known/timestamppb"

"github.com/google/fleetspeak/fleetspeak/src/client/internal/monitoring"
"github.com/google/fleetspeak/fleetspeak/src/client/service"
Expand Down
5 changes: 3 additions & 2 deletions fleetspeak/src/common/proto/fleetspeak/common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions fleetspeak/src/common/proto/fleetspeak/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ syntax = "proto3";

package fleetspeak;

option go_package = "github.com/google/fleetspeak/fleetspeak/src/common/proto/fleetspeak";

import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/google/fleetspeak/fleetspeak/src/common/proto/fleetspeak";

// An Address identifies the source or destination of a message.
message Address {
// The client_id, if the address refers to a service on a client. If unset,
Expand Down Expand Up @@ -69,7 +69,7 @@ message Message {
// The message priority. The primary effect is on the ordering of messages
// sent from the client to the server.
enum Priority {
MEDIUM = 0; // Out of order, but results in a sensible default.
MEDIUM = 0; // Out of order, but results in a sensible default.
LOW = 1;
HIGH = 2;
}
Expand Down Expand Up @@ -131,11 +131,11 @@ message Signature {
// A WrappedContactData is provided by the client to the server with every
// contact.
message WrappedContactData {
bytes contact_data = 1; // A serialized ContactData.
repeated Signature signatures = 2; // Optional extra signatures validating
// contact_data.
repeated string client_labels = 3; // The labels that the client claims to
// have.
bytes contact_data = 1; // A serialized ContactData.
repeated Signature signatures = 2; // Optional extra signatures validating
// contact_data.
repeated string client_labels = 3; // The labels that the client claims to
// have.
}

// On every contact, the client and server exchange ContactData messages.
Expand All @@ -148,7 +148,7 @@ message ContactData {

// Records the client's current time setting, as of the creation of this
// ContactData. Only set by the client.
google.protobuf.Timestamp client_clock = 3;
google.protobuf.Timestamp client_clock = 3;

// If set, acknowledges receipt of a streamed WrappedContactData. This is used
// for control purposes during streaming connections.
Expand All @@ -159,11 +159,11 @@ message ContactData {
bool done_sending = 5;

// Set by the client to indicate how many messages it is willing to accept for
// each installed service. After the first exchange of an streaming connection, it
// represents the number of additional messages that will be accepted.
// each installed service. After the first exchange of an streaming
// connection, it represents the number of additional messages that will be
// accepted.
map<string, uint64> AllowedMessages = 6;
}

// An empty message, typically used as a trivial RPC response.
message EmptyMessage {
}
message EmptyMessage {}
18 changes: 9 additions & 9 deletions fleetspeak/src/common/proto/fleetspeak/system.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a5862c9

Please sign in to comment.