diff options
| author | Jeff Carr <[email protected]> | 2025-02-15 05:35:01 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-15 05:35:01 -0600 |
| commit | 7900b1416e94feeadf133232e33f2938b672702f (patch) | |
| tree | f7b71f4d0ae197325e155a06ff7735fd03c5cb58 /identify.go | |
| parent | 5c84b9ab6642fd3394c83ffc97648750eaa625f7 (diff) | |
add IdentifyProtobuf()v0.0.78
Diffstat (limited to 'identify.go')
| -rw-r--r-- | identify.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/identify.go b/identify.go new file mode 100644 index 0000000..c84f385 --- /dev/null +++ b/identify.go @@ -0,0 +1,17 @@ +package forgepb + +import ( + "go.wit.com/log" +) + +// print the protobuf in human form +func IdentifyProtobuf(data []byte) error { + var pb *Identify + pb = new(Identify) + if err := pb.Unmarshal(data); err != nil { + log.Info("data can't be identified as a standard protobuf. len =", len(data)) + return err + } + log.Info("Identify protobuf file uuid =", pb.Uuid, "version =", pb.Version) + return nil +} |
