Skip to content

Commit

Permalink
Adds go package paths and updates the README with instructions for ge…
Browse files Browse the repository at this point in the history
…nerating Go code
  • Loading branch information
christianrowlands committed Aug 16, 2024
1 parent c1391b1 commit edc359a
Show file tree
Hide file tree
Showing 43 changed files with 64 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,5 @@ gradle.properties
*~

.java-version
/builddocs
/builddocs
src/main/output/*
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Network Survey Messaging
- [Some Details](#some-details)
- [Why are there protobuf files?](#why-are-there-protobuf-files?)
- [Build and development instructions](#build-and-development-instructions)
- [Generating Go Code](#generating-go-code)
- [Change log](#change-log)
- [Contact](#contact)

Expand Down Expand Up @@ -110,6 +111,26 @@ Generated code is here:
- Java: build/generated/source/proto/main/java/com/craxiom/messaging
- Python: build/generated/source/proto/main/python/com/craxiom/messaging

#### Generating Go code
The Go code is generated using the `protoc` compiler. The `protoc` compiler can be installed using the following command:
- `brew install protobuf`

The Go code is generated using the following command:
- `protoc --go_out=go/ --go_opt=paths=source_relative --go-grpc_out=go/ --go-grpc_opt=paths=source_relative src/main/proto/*.proto`

More specifically, I used the following commands:
```shell
cd src/main
mkdir output
find ./proto -name "*.proto" | xargs protoc -I=./proto --go_out=./output --go-grpc_out=./output
```

#### Example gRPC Server written in Go

If you want to see how to use the generated Go code to create a gRPC server, check out the code at https://github.com/christianrowlands/ns-messaging-go-grpc-server

The server does not do anything useful, but serves as an example of how one might be created in GoLang.

## Change log

See the change log for details about each release: [`CHANGELOG.md`](CHANGELOG.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.bluetooth.supportedtech;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.bluetooth";
option go_package = "craxiom.com/messaging";

enum SupportedTechnologies {
UNKNOWN = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package com.craxiom.messaging.bluetooth.tech;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.bluetooth";
option go_package = "craxiom.com/messaging";

enum Technology {
UNKNOWN = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import "com/craxiom/messaging/bluetooth/supportedtech/supported_technologies.pro

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message BluetoothRecord {
string version = 1;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/cdma_record.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "google/protobuf/wrappers.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message CdmaRecord {
string version = 1;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/device_status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "google/protobuf/wrappers.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message DeviceStatus {
string version = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "google/protobuf/wrappers.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message EnergyDetection {
string version = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.gnss.constellation;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.gnss";
option go_package = "craxiom.com/messaging";

enum Constellation {
UNKNOWN = 0;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/gnss_record.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import "com/craxiom/messaging/gnss/constellation.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message GnssRecord {
string version = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package com.craxiom.messaging.grpc;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.grpc";
option go_package = "craxiom.com/messaging";

service ConnectionHandshake {
rpc StartConnection (ConnectionRequest) returns (ConnectionReply) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "com/craxiom/messaging/device_status.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.grpc";
option go_package = "craxiom.com/messaging";

service DeviceStatus {
rpc StatusUpdate (stream com.craxiom.messaging.DeviceStatus) returns (StatusUpdateReply) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import "com/craxiom/messaging/signal_detection.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.grpc";
option go_package = "craxiom.com/messaging";

service WirelessSurvey {
rpc StreamGsmSurvey (stream GsmRecord) returns (GsmSurveyResponse) {
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/gsm_record.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "google/protobuf/wrappers.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message GsmRecord {
string version = 1;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/gsm_signaling.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "com/craxiom/messaging/gsmsignalingchanneltype/gsm_signaling_channel_type

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message GsmSignaling {
string version = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.gsmsignalingchanneltype;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

enum GsmSignalingChannelType {
UNKNOWN = 0;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/lte_nas.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "com/craxiom/messaging/ltenaschanneltype/lte_nas_channel_type.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message LteNas {
string version = 1;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/lte_record.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import "com/craxiom/messaging/ltebandwidth/lte_bandwidth.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message LteRecord {
string version = 1;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/lte_rrc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "com/craxiom/messaging/lterrcchanneltype/lte_rrc_channel_type.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message LteRrc {
string version = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.ltebandwidth;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

enum LteBandwidth {
UNKNOWN = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.ltenaschanneltype;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

enum LteNasChannelType {
UNKNOWN = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.lterrcchanneltype;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

enum LteRrcChannelType {
UNKNOWN = 0;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/nr_record.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "google/protobuf/wrappers.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message NrRecord {
string version = 1;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/phone_state.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import "com/craxiom/messaging/phonestate/simstate/sim_state.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message PhoneState {
string version = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.phonestate.domain;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.phonestate";
option go_package = "craxiom.com/messaging";

/*
* This enum defines the Domain field of the Phone State message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.phonestate.networktype;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.phonestate";
option go_package = "craxiom.com/messaging";

/*
* This enum defines the Access Network Technology field of the Phone State message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.phonestate.simstate;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.phonestate";
option go_package = "craxiom.com/messaging";

/*
* This enum defines the SIM State field of the Phone State message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "google/protobuf/wrappers.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message SignalDetection {
string version = 1;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/umts_nas.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package com.craxiom.messaging;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message UmtsNas {
string version = 1;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/umts_record.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "google/protobuf/wrappers.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message UmtsRecord {
string version = 1;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/wcdma_rrc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import "com/craxiom/messaging/wcdmarrcchanneltype/wcdma_rrc_channel_type.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message WcdmaRrc {
string version = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.wcdmarrcchanneltype;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

enum WcdmaRrcChannelType {
UNKNOWN = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.wifi.akmsuite;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.wifi";
option go_package = "craxiom.com/messaging";

/*
* This enum defines the AKM Suites field of the 802.11 messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.wifi.bandwidth;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.wifi";
option go_package = "craxiom.com/messaging";

enum WifiBandwidth {
UNKNOWN = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.wifi.ciphersuite;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.wifi";
option go_package = "craxiom.com/messaging";

/*
* This enum defines the Cipher Suites field of the 802.11 messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.wifi.encryptiontype;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.wifi";
option go_package = "craxiom.com/messaging";

/**
* This enum defines the Encryption Type field of the 802.11 messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.wifi.nodetype;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.wifi";
option go_package = "craxiom.com/messaging";

enum NodeType {
UNKNOWN = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.wifi.serviceset;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.wifi";
option go_package = "craxiom.com/messaging";

enum ServiceSetType {
UNKNOWN = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.craxiom.messaging.wifi.standard;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging.wifi";
option go_package = "craxiom.com/messaging";

enum Standard {
UNKNOWN = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import "com/craxiom/messaging/wifi/bandwidth/wifi_bandwidth.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message WifiBeaconRecord {
string version = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import "com/craxiom/messaging/wifi/standard/standard.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message WifiDeauthenticationRecord {
string version = 1;
Expand Down
1 change: 1 addition & 0 deletions src/main/proto/com/craxiom/messaging/wifi_ota_record.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package com.craxiom.messaging;

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message WifiOtaRecord {
string version = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import "com/craxiom/messaging/wifi/standard/standard.proto";

option java_multiple_files = true;
option java_package = "com.craxiom.messaging";
option go_package = "craxiom.com/messaging";

message WifiProbeRequestRecord {
string version = 1;
Expand Down

0 comments on commit edc359a

Please sign in to comment.