parent
88d5b4d875
commit
b9b85e858f
|
@ -0,0 +1,33 @@
|
|||
Name: Build and Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
releases-matrix:
|
||||
name: Build and Release
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [linux, windows, darwin]
|
||||
goarch: ["386", amd64, arm64]
|
||||
exclude:
|
||||
- goarch: "386"
|
||||
goos: darwin
|
||||
- goarch: arm64
|
||||
goos: windows
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: wangyoucao577/go-release-action@v1.35
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
goos: ${{ matrix.goos }}
|
||||
goarch: ${{ matrix.goarch }}
|
||||
goversion: "https://dl.google.com/go/go1.19.5.linux-amd64.tar.gz"
|
||||
project_path: "./cmd/HellPot"
|
||||
binary_name: "HellPot"
|
||||
extra_files: LICENSE README.md
|
||||
build_flags: -trimpath
|
||||
pre_command: export CGO_ENABLED=0
|
||||
ldflags: -s -w
|
|
@ -14,7 +14,7 @@ jobs:
|
|||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.18
|
||||
go-version: 1.19
|
||||
- name: go vet -v ./...
|
||||
run: go vet -v ./...
|
||||
- name: gosec ./...
|
||||
|
@ -22,5 +22,7 @@ jobs:
|
|||
export PATH=$PATH:$(go env GOPATH)/bin
|
||||
go install github.com/securego/gosec/v2/cmd/gosec@latest
|
||||
gosec ./...
|
||||
- name: go test -v ./...
|
||||
run: go test -v ./...
|
||||
- name: go build -v ./...
|
||||
run: go build -v ./...
|
||||
|
|
|
@ -18,7 +18,9 @@ func listenOnUnixSocket(addr string, r *router.Router) error {
|
|||
var unixAddr *net.UnixAddr
|
||||
var unixListener *net.UnixListener
|
||||
unixAddr, err = net.ResolveUnixAddr("unix", addr)
|
||||
if err == nil {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Always unlink sockets before listening on them
|
||||
_ = syscall.Unlink(addr)
|
||||
// Before we set socket permissions, we want to make sure only the user HellPot is running under
|
||||
|
@ -26,12 +28,15 @@ func listenOnUnixSocket(addr string, r *router.Router) error {
|
|||
oldmask := syscall.Umask(0o077)
|
||||
unixListener, err = net.ListenUnix("unix", unixAddr)
|
||||
syscall.Umask(oldmask)
|
||||
if err == nil {
|
||||
err = os.Chmod(unixAddr.Name, os.FileMode(config.UnixSocketPermissions))
|
||||
if err == nil {
|
||||
err = fasthttp.Serve(unixListener, r.Handler)
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = os.Chmod(
|
||||
unixAddr.Name,
|
||||
os.FileMode(config.UnixSocketPermissions),
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return fasthttp.Serve(unixListener, r.Handler)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue