diff --git a/.goreleaser.yml b/.goreleaser.yml index a84d294..232c4ce 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -8,32 +8,33 @@ builds: - CGO_ENABLED=0 goarch: - amd64 + - arm64 goos: - linux - - windows - darwin ldflags: - >- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} - -X main.date={{.CommitDate}} release: draft: true github: owner: NETWAYS name: check_sentinelone archives: - - format: binary + - formats: + - binary name_template: >- {{ .ProjectName }}_{{ .Tag }}_ {{- if eq .Os "linux" }}Linux{{ end }} {{- if eq .Os "windows" }}Windows{{ end }} {{- if eq .Os "darwin" }}Darwin{{ end }} {{- if eq .Arch "amd64" }}_x86_64{{ end }} + {{- if eq .Arch "arm64" }}_arm64{{ end }} checksum: name_template: 'checksums.txt' snapshot: - name_template: '{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}' + version_template: '{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}' changelog: sort: asc filters: diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index a7814b8..0000000 --- a/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Markus Frosch diff --git a/COPYING b/LICENSE similarity index 100% rename from COPYING rename to LICENSE diff --git a/README.md b/README.md index 496ca6c..10a56a4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -check_sentinelone -================= +# check_sentinelone Check for threats on the SentinelOne Cloud service. diff --git a/api/client.go b/api/client.go index aa52081..e473ce3 100644 --- a/api/client.go +++ b/api/client.go @@ -35,8 +35,8 @@ func NewClient(url, token string, timeout time.Duration) (c *Client) { } func (c *Client) NewRequest(method, url string, body io.Reader) (req *http.Request, err error) { + // We use a general timeout for the entire client // nolint: noctx - // TODO Add context req, err = http.NewRequest(method, c.ManagementURL+"/web/api/"+url, body) if err != nil { err = fmt.Errorf("could not create http request: %w", err) @@ -55,3 +55,21 @@ func (c *Client) Do(req *http.Request) (res *http.Response, err error) { return } + +type LoggingRoundTripper struct { + Base http.RoundTripper +} + +// NewLoggingHTTPClient prepares a custom client that using a logging transport. +func NewLoggingHTTPClient() *http.Client { + client := *http.DefaultClient + client.Transport = LoggingRoundTripper{http.DefaultTransport} + + return &client +} + +func (r LoggingRoundTripper) RoundTrip(req *http.Request) (res *http.Response, err error) { + res, err = r.Base.RoundTrip(req) + + return +} diff --git a/api/response.go b/api/response.go index 29e5a6e..665adde 100644 --- a/api/response.go +++ b/api/response.go @@ -122,7 +122,6 @@ func (c *Client) GetJSONItems(request *http.Request) (items []json.RawMessage, e } // set nextCursor or break iteration when done. - // nolint: gocritic if response.Pagination.NextCursor == "" { break } else if response.Pagination.NextCursor == nextCursor { diff --git a/api/trace.go b/api/trace.go deleted file mode 100644 index bf20532..0000000 --- a/api/trace.go +++ /dev/null @@ -1,23 +0,0 @@ -package api - -import ( - "net/http" -) - -type LoggingRoundTripper struct { - Base http.RoundTripper -} - -// NewLoggingHTTPClient prepares a custom client that using a logging transport. -func NewLoggingHTTPClient() *http.Client { - client := *http.DefaultClient - client.Transport = LoggingRoundTripper{http.DefaultTransport} - - return &client -} - -func (r LoggingRoundTripper) RoundTrip(req *http.Request) (res *http.Response, err error) { - res, err = r.Base.RoundTrip(req) - - return -} diff --git a/version.go b/version.go index b92520a..017f750 100644 --- a/version.go +++ b/version.go @@ -15,7 +15,6 @@ the Free Software Foundation, either version 3 of the License, or var ( version = "development" commit = "HEAD" - date = "latest" ) func buildVersion() string { @@ -25,10 +24,6 @@ func buildVersion() string { result = fmt.Sprintf("%s\ncommit: %s", result, commit) } - if date != "" { - result = fmt.Sprintf("%s\ndate: %s", result, date) - } - result += "\n" + license return result