From f8d87e48b22b43f50a0ab3d41a1d1125f7e645f1 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 17 Oct 2023 21:44:00 +0000 Subject: [PATCH 1/7] Add a spec file for RPM building. --- golang-github-farsightsec-sielink.spec | 45 ++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 golang-github-farsightsec-sielink.spec diff --git a/golang-github-farsightsec-sielink.spec b/golang-github-farsightsec-sielink.spec new file mode 100644 index 0000000..63ca647 --- /dev/null +++ b/golang-github-farsightsec-sielink.spec @@ -0,0 +1,45 @@ +%global debug_package %{nil} + +# https://github.com/farsightsec/sielink +%global goipath github.com/farsightsec/sielink +Version: 0.1.1 + +%gometa + +%global common_description %{expand: +Implements the protocol used for communication between SIE sensors and submission servers, as well for coordination between submission servers.} + +%global golicenses LICENSE +%global godocs README.md + +Name: %{goname} +Release: %autorelease +Summary: Sielink protocol library + +License: MPLv2.0 +URL: %{gourl} +Source0: %{gosource} + +%description +%{common_description} + +%gopkg + +%prep +%goprep + +%generate_buildrequires +%go_generate_buildrequires + +%install +%gopkginstall + +%if %{with check} +%check +%gocheck +%endif + +%gopkgfiles + +%changelog +%autochangelog From 392a4070729dad19d4fcb89c7dfabca69d45b37a Mon Sep 17 00:00:00 2001 From: Maximillian Crawford Date: Wed, 9 Apr 2025 12:17:06 -0400 Subject: [PATCH 2/7] Try the working pattern --- golang-github-farsightsec-sielink.spec | 47 +++++++++++++++++++++----- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/golang-github-farsightsec-sielink.spec b/golang-github-farsightsec-sielink.spec index 63ca647..2ab5b71 100644 --- a/golang-github-farsightsec-sielink.spec +++ b/golang-github-farsightsec-sielink.spec @@ -23,23 +23,52 @@ Source0: %{gosource} %description %{common_description} -%gopkg - %prep -%goprep - -%generate_buildrequires -%go_generate_buildrequires +%setup -q %install -%gopkginstall +install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ +for file in $(find . -iname "*.go" \! -iname "*_test.go" \! -iname "main.go" ) ; do + echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list + install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) + cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file + echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list +done +# source codes for building projects +install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ +echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list +# find all *.s and generate devel.file-list +for file in $(find . -iname "*.s") ; do + echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list + install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) + cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file + echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list +done +# find all *.c and generate devel.file-list +for file in $(find . -iname "*.c") ; do + echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list + install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) + cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file + echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list +done +# find all *.go but no *_test.go files and generate devel.file-list +for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do + echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list + install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) + cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file + echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list +done +sort -u -o devel.file-list devel.file-list +install -m 0755 -vd %{buildroot}%{gopath}/src/%(dirname %{oldgoipath}) + +%if %{rhel} != 8 %if %{with check} %check %gocheck %endif +%endif -%gopkgfiles +%files -n %{goname}-devel -f devel.file-list %changelog -%autochangelog From fb751ec88b5f11d2b8ebed456d87dc301a30c56e Mon Sep 17 00:00:00 2001 From: Maximillian Crawford Date: Wed, 9 Apr 2025 12:19:06 -0400 Subject: [PATCH 3/7] Tweaks --- golang-github-farsightsec-sielink.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/golang-github-farsightsec-sielink.spec b/golang-github-farsightsec-sielink.spec index 2ab5b71..876fa5b 100644 --- a/golang-github-farsightsec-sielink.spec +++ b/golang-github-farsightsec-sielink.spec @@ -13,7 +13,7 @@ Implements the protocol used for communication between SIE sensors and submissio %global godocs README.md Name: %{goname} -Release: %autorelease +Release: 1%{?dist} Summary: Sielink protocol library License: MPLv2.0 @@ -23,6 +23,12 @@ Source0: %{gosource} %description %{common_description} +%package -n %{goname}-devel +Summary: %{summary} +BuildArch: noarch +%description -n %{goname}-devel +%{common_description} + %prep %setup -q From 363c38f6dd1d6957f09328d793f236279428ca2b Mon Sep 17 00:00:00 2001 From: Maximillian Crawford Date: Wed, 9 Apr 2025 12:21:10 -0400 Subject: [PATCH 4/7] Try repo-matching source package name --- golang-github-farsightsec-sielink.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/golang-github-farsightsec-sielink.spec b/golang-github-farsightsec-sielink.spec index 876fa5b..2eaf418 100644 --- a/golang-github-farsightsec-sielink.spec +++ b/golang-github-farsightsec-sielink.spec @@ -12,7 +12,7 @@ Implements the protocol used for communication between SIE sensors and submissio %global golicenses LICENSE %global godocs README.md -Name: %{goname} +Name: sielink Release: 1%{?dist} Summary: Sielink protocol library From 075cabae265ffec2e52f18900b7865ebeeb5efa9 Mon Sep 17 00:00:00 2001 From: mcrawforddt <153119983+mcrawforddt@users.noreply.github.com> Date: Mon, 14 Apr 2025 13:19:48 -0400 Subject: [PATCH 5/7] Update golang-github-farsightsec-sielink.spec --- golang-github-farsightsec-sielink.spec | 36 ++++---------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/golang-github-farsightsec-sielink.spec b/golang-github-farsightsec-sielink.spec index 2eaf418..1581639 100644 --- a/golang-github-farsightsec-sielink.spec +++ b/golang-github-farsightsec-sielink.spec @@ -33,40 +33,14 @@ BuildArch: noarch %setup -q %install -install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ +find . for file in $(find . -iname "*.go" \! -iname "*_test.go" \! -iname "main.go" ) ; do - echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list - install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) - cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file - echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list -done - -# source codes for building projects -install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ -echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list -# find all *.s and generate devel.file-list -for file in $(find . -iname "*.s") ; do - echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list - install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) - cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file - echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list -done -# find all *.c and generate devel.file-list -for file in $(find . -iname "*.c") ; do - echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list - install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) - cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file - echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list -done -# find all *.go but no *_test.go files and generate devel.file-list -for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do - echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list - install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) - cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file - echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list + echo "%%dir %%{gopath}/src/%%{goipath}/$(dirname $file)" >> devel.file-list + install -d -p %{buildroot}/%{gopath}/src/%{goipath}/$(dirname $file) + cp -pav $file %{buildroot}/%{gopath}/src/%{goipath}/$file + echo "%%{gopath}/src/%%{goipath}/$file" >> devel.file-list done sort -u -o devel.file-list devel.file-list -install -m 0755 -vd %{buildroot}%{gopath}/src/%(dirname %{oldgoipath}) %if %{rhel} != 8 %if %{with check} From adc7a503b15a66c858f3cdce54d6d3260af0b7a5 Mon Sep 17 00:00:00 2001 From: Maximillian Crawford Date: Mon, 14 Apr 2025 19:01:53 -0400 Subject: [PATCH 6/7] New repo --- README.md | 4 ++-- rawlink/confmessage.go | 2 +- rawlink/link_test.go | 2 +- rawlink/message.go | 2 +- rawlink/sender.go | 2 +- sielink.go | 2 +- sielink.pb.go | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d6ddf27..c92b7b3 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ It contains two subdirectories: `sielink` relies on the following two go libraries: - * github.com/golang/protobuf/proto + * google.golang.org/protobuf/proto * golang.org/x/net/websocket ## Client Usage @@ -47,7 +47,7 @@ and tagged with a data type (sielink only supports NMSG container data as of this writing) and channel. import ( - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "github.com/farsightsec/sielink" ) diff --git a/rawlink/confmessage.go b/rawlink/confmessage.go index c369f27..08a920d 100644 --- a/rawlink/confmessage.go +++ b/rawlink/confmessage.go @@ -9,7 +9,7 @@ package rawlink import ( - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "github.com/farsightsec/sielink" ) diff --git a/rawlink/link_test.go b/rawlink/link_test.go index 6a3eb19..6fe9a33 100644 --- a/rawlink/link_test.go +++ b/rawlink/link_test.go @@ -15,7 +15,7 @@ import ( "testing" "time" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "github.com/farsightsec/sielink" "github.com/farsightsec/sielink/rawlink" diff --git a/rawlink/message.go b/rawlink/message.go index 4e1a520..51f6cc8 100644 --- a/rawlink/message.go +++ b/rawlink/message.go @@ -9,7 +9,7 @@ package rawlink import ( - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "golang.org/x/net/websocket" "github.com/farsightsec/sielink" ) diff --git a/rawlink/sender.go b/rawlink/sender.go index cf7f634..a33a599 100644 --- a/rawlink/sender.go +++ b/rawlink/sender.go @@ -11,7 +11,7 @@ package rawlink import ( "time" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" "golang.org/x/net/websocket" "github.com/farsightsec/sielink" ) diff --git a/sielink.go b/sielink.go index 778793c..defc1eb 100644 --- a/sielink.go +++ b/sielink.go @@ -11,7 +11,7 @@ package sielink import ( "fmt" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" ) // ProtocolVersion is the version of the protocol implemented diff --git a/sielink.pb.go b/sielink.pb.go index 51a39a7..bdb84c0 100644 --- a/sielink.pb.go +++ b/sielink.pb.go @@ -19,7 +19,7 @@ It has these top-level messages: */ package sielink -import proto "github.com/golang/protobuf/proto" +import proto "google.golang.org/protobuf/proto" import fmt "fmt" import math "math" From f49ebb6a87ae482272daf8d55f42e12aa049fa0a Mon Sep 17 00:00:00 2001 From: Maximillian Crawford Date: Mon, 14 Apr 2025 19:38:29 -0400 Subject: [PATCH 7/7] Roll back to old protobuf --- README.md | 4 ++-- go.mod | 11 +++++++++++ go.sum | 12 ++++++++++++ rawlink/confmessage.go | 2 +- rawlink/link_test.go | 2 +- rawlink/message.go | 2 +- rawlink/sender.go | 2 +- sielink.go | 2 +- sielink.pb.go | 2 +- 9 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 go.mod create mode 100644 go.sum diff --git a/README.md b/README.md index c92b7b3..d6ddf27 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ It contains two subdirectories: `sielink` relies on the following two go libraries: - * google.golang.org/protobuf/proto + * github.com/golang/protobuf/proto * golang.org/x/net/websocket ## Client Usage @@ -47,7 +47,7 @@ and tagged with a data type (sielink only supports NMSG container data as of this writing) and channel. import ( - "google.golang.org/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/farsightsec/sielink" ) diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..43f7628 --- /dev/null +++ b/go.mod @@ -0,0 +1,11 @@ +module sielink + +go 1.18 + +require ( + github.com/farsightsec/sielink v0.1.1 + github.com/golang/protobuf v1.5.0 + golang.org/x/net v0.39.0 +) + +require google.golang.org/protobuf v1.26.0-rc.1 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..8dbfc76 --- /dev/null +++ b/go.sum @@ -0,0 +1,12 @@ +github.com/farsightsec/sielink v0.1.1 h1:eRh9/jDTyfF3YksJx5/GvbU3+oXI8JDosswfQemV4dg= +github.com/farsightsec/sielink v0.1.1/go.mod h1:PtR+AqhrW7ZC7GPJgZUrbGcaYSY4lpa6ZnZ0tcWsE5U= +github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= +golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.26.0-rc.1 h1:7QnIQpGRHE5RnLKnESfDoxm2dTapTZua5a0kS0A+VXQ= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= diff --git a/rawlink/confmessage.go b/rawlink/confmessage.go index 08a920d..c369f27 100644 --- a/rawlink/confmessage.go +++ b/rawlink/confmessage.go @@ -9,7 +9,7 @@ package rawlink import ( - "google.golang.org/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/farsightsec/sielink" ) diff --git a/rawlink/link_test.go b/rawlink/link_test.go index 6fe9a33..6a3eb19 100644 --- a/rawlink/link_test.go +++ b/rawlink/link_test.go @@ -15,7 +15,7 @@ import ( "testing" "time" - "google.golang.org/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/farsightsec/sielink" "github.com/farsightsec/sielink/rawlink" diff --git a/rawlink/message.go b/rawlink/message.go index 51f6cc8..4e1a520 100644 --- a/rawlink/message.go +++ b/rawlink/message.go @@ -9,7 +9,7 @@ package rawlink import ( - "google.golang.org/protobuf/proto" + "github.com/golang/protobuf/proto" "golang.org/x/net/websocket" "github.com/farsightsec/sielink" ) diff --git a/rawlink/sender.go b/rawlink/sender.go index a33a599..cf7f634 100644 --- a/rawlink/sender.go +++ b/rawlink/sender.go @@ -11,7 +11,7 @@ package rawlink import ( "time" - "google.golang.org/protobuf/proto" + "github.com/golang/protobuf/proto" "golang.org/x/net/websocket" "github.com/farsightsec/sielink" ) diff --git a/sielink.go b/sielink.go index defc1eb..778793c 100644 --- a/sielink.go +++ b/sielink.go @@ -11,7 +11,7 @@ package sielink import ( "fmt" - "google.golang.org/protobuf/proto" + "github.com/golang/protobuf/proto" ) // ProtocolVersion is the version of the protocol implemented diff --git a/sielink.pb.go b/sielink.pb.go index bdb84c0..51a39a7 100644 --- a/sielink.pb.go +++ b/sielink.pb.go @@ -19,7 +19,7 @@ It has these top-level messages: */ package sielink -import proto "google.golang.org/protobuf/proto" +import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math"