Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,62 @@
"postUpdateOptions": [
"gomodTidy"
],
"packageRules": [
{
"matchManagers": [
"github-actions"
],
"matchUpdateTypes": [
"patch",
"minor"
],
"groupName": "github-actions",
"groupSlug": "github-actions"
},
{
"matchManagers": [
"gomod"
],
"matchUpdateTypes": [
"patch",
"minor"
],
"matchPackageNames": [
"github.com/google/**",
"github.com/spf13/**",
"github.com/vishvananda/**",
"github.com/yl2chen/**",
"go.uber.org/atomic",
"go.uber.org/multierr",
"go.uber.org/ratelimit",
"go.uber.org/zap",
"golang.org/x/**",
"gopkg.in/yaml.v3"
],
"groupName": "go runtime dependencies",
"groupSlug": "go-runtime"
},
{
"matchManagers": [
"gomod"
],
"matchUpdateTypes": [
"patch",
"minor"
],
"matchPackageNames": [
"github.com/benbjohnson/**",
"github.com/davecgh/**",
"github.com/inconshreveable/**",
"github.com/josharian/**",
"github.com/pmezard/**",
"github.com/stretchr/**",
"go.uber.org/mock"
],
"groupName": "go dev dependencies",
"groupSlug": "go-dev"
}
],
"ignoreDeps": [
"golang.org/x/net"
]
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:
jobs:
go:
runs-on: ubuntu-latest
container: golang:1.19-alpine
container: golang:1.25-alpine
env:
CGO_ENABLED: 1
GOFLAGS: -buildvcs=false
Expand Down Expand Up @@ -44,24 +44,19 @@ jobs:
path: |
/go/pkg/mod
/root/.cache/go-build
key: ${{ runner.os }}-go-1.19-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-1.25-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-1.19-
${{ runner.os }}-go-1.25-

- name: Check Go formatting
run: test -z "$(gofmt -l .)"

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v9
with:
version: v1.49.0
version: v2.12
args: --verbose

- name: Run revive
run: |
go install github.com/mgechev/revive@v1.2.3
"$(go env GOPATH)/bin/revive" -config .revive.toml -formatter friendly ./...

- name: Run Go tests
run: go test ./... -v -cover

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ concurrency:
jobs:
release:
runs-on: ubuntu-latest
container: golang:1.19-alpine
container: golang:1.25-alpine
env:
RELEASE_KIND: ${{ inputs.release_kind }}
CGO_ENABLED: 1
Expand Down Expand Up @@ -52,9 +52,9 @@ jobs:
path: |
/go/pkg/mod
/root/.cache/go-build
key: ${{ runner.os }}-go-1.19-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-1.25-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-1.19-
${{ runner.os }}-go-1.25-

- name: Install git-cliff
uses: taiki-e/install-action@git-cliff
Expand Down
74 changes: 51 additions & 23 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,69 @@
version: "2"

linters:
disable:
- errcheck
enable:
- dogsled
- exportloopref
- gochecknoinits
- funlen
- gocognit
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- nolintlint
- paralleltest
- testifylint
- staticcheck
- gosec
- govet
- misspell
- nestif
- prealloc
- revive
- unconvert
- unparam
exclusions:
paths:
- ".*_easyjson\\.go$"
rules:
- linters:
- gosec
text: "G404" # math/rand; used to generate pseudo-random source ports
- linters:
- gosec
text: "G115" # integer conversion
- linters:
- funlen
- goconst
path: _test\.go
settings:
revive:
severity: warning
confidence: 0.8
rules:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: empty-block
- name: superfluous-else
- name: unhandled-error
- name: unused-receiver
- name: unreachable-code
- name: range-val-in-closure
- name: range-val-address
- name: waitgroup-by-value
- name: atomic
- name: early-return
- name: unconditional-recursion
- name: identical-branches

formatters:
enable:
- gofmt
- goimports

run:
timeout: 3m
skip-files:
- ".*_easyjson\\.go$"

issues:
exclude-rules:
- linters:
- gosec
text: "G404" # math/rand; used to generate pseudo-random source ports
- path: pkg/scan/elastic
linters:
- gosec
text: "G402" # TLS insecure; used in Elasticsearch scan to ignore TLS cert
- path: pkg/scan/docker
linters:
- gosec
text: "G402" # TLS insecure; used in Docker scan to ignore TLS cert
- linters:
- funlen
path: _test\.go
44 changes: 0 additions & 44 deletions .revive.toml

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM golang:1.19-alpine as builder
FROM golang:1.25-alpine AS builder

RUN apk add --no-cache libpcap-dev libc-dev gcc linux-headers
ADD . /app
WORKDIR /app
RUN go build -ldflags "-w -s -linkmode external -extldflags '-static'" -o /sx

FROM alpine:3.16
FROM alpine:3.24

COPY --from=builder /sx /sx
ENTRYPOINT ["/sx"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div align="center">

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/v-byte-cpu/sx/blob/master/LICENSE)
[![Build Status](https://cloud.drone.io/api/badges/v-byte-cpu/sx/status.svg)](https://cloud.drone.io/v-byte-cpu/sx)
[![Build Status](https://github.com/v-byte-cpu/sx/actions/workflows/ci.yml/badge.svg)](https://github.com/v-byte-cpu/sx/actions/workflows/ci.yml)
[![GoReportCard Status](https://goreportcard.com/badge/github.com/v-byte-cpu/sx)](https://goreportcard.com/report/github.com/v-byte-cpu/sx)
![Platform](https://img.shields.io/badge/platform-linux%2Fdocker-blue)

Expand Down Expand Up @@ -51,7 +51,7 @@ The simplest way is to download from [GitHub Releases](https://github.com/v-byte

Requirements:

* [Go 1.15 or newer](https://golang.org/dl/)
* [Go 1.25 or newer](https://golang.org/dl/)
* [libpcap](https://www.tcpdump.org/) (already installed if you use **wireshark**)

From the root of the source tree, run:
Expand Down
2 changes: 1 addition & 1 deletion command/arp.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (o *arpCmdOpts) getLogger() (logger log.Logger, err error) {
}

func (o *arpCmdOpts) newARPScanMethod(ctx context.Context) *arp.ScanMethod {
var reqgen scan.RequestGenerator = scan.NewIPRequestGenerator(scan.NewIPGenerator())
reqgen := scan.NewIPRequestGenerator(scan.NewIPGenerator())
if o.excludeIPs != nil {
reqgen = scan.NewFilterIPRequestGenerator(reqgen, o.excludeIPs)
}
Expand Down
4 changes: 3 additions & 1 deletion command/arp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ func TestArpCmdDstSubnetError(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
cmd := newARPCmd().cmd
err := cmd.RunE(cmd, tt.args)
require.Error(t, err)
Expand All @@ -47,7 +49,7 @@ func TestARPCmdOptsInitCliFlags(t *testing.T) {
}, " "), " "))

require.NoError(t, err)
require.Equal(t, true, opts.json)
require.True(t, opts.json)
require.Equal(t, "eth0", opts.rawInterface)
require.Equal(t, net.IPv4(192, 168, 0, 1), opts.srcIP)
require.Equal(t, "00:11:22:33:44:55", opts.rawSrcMAC)
Expand Down
Loading