Compare commits
4 Commits
88d5b4d875
...
921beaeeb4
Author | SHA1 | Date |
---|---|---|
kayos@tcp.direct | 921beaeeb4 | |
kayos@tcp.direct | 130f127bb3 | |
kayos@tcp.direct | a9ca163e17 | |
kayos | b9b85e858f |
|
@ -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 ./...
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
name: Build and Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
repository:
|
||||
description: 'The repository from which the slash command was dispatched'
|
||||
required: true
|
||||
comment-id:
|
||||
description: 'The comment-id of the slash command'
|
||||
required: true
|
||||
tag:
|
||||
description: 'The tag to be released'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
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
|
||||
release_tag: ${{ github.event.inputs.tag }}
|
||||
- name: Add reaction
|
||||
uses: peter-evans/create-or-update-comment@v2
|
||||
with:
|
||||
token: ${{ secrets.PAT }}
|
||||
repository: ${{ github.event.inputs.repository }}
|
||||
comment-id: ${{ github.event.inputs.comment-id }}
|
||||
reaction-type: hooray
|
|
@ -0,0 +1,21 @@
|
|||
name: Slash Command Dispatch
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
jobs:
|
||||
slashCommandDispatch:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Slash Command Dispatch
|
||||
id: scd
|
||||
uses: peter-evans/slash-command-dispatch@v3
|
||||
with:
|
||||
token: ${{ secrets.PAT }}
|
||||
commands: |
|
||||
release
|
||||
dispatch-type: workflow
|
||||
permission: admin
|
||||
repository: yunginnanet/HellPot
|
||||
static-args: |
|
||||
repository=${{ github.repository }}
|
||||
comment-id=${{ github.event.comment.id }}
|
|
@ -18,20 +18,25 @@ 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 {
|
||||
// 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
|
||||
// has permission to the socket.
|
||||
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
|
||||
}
|
||||
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
|
||||
// has permission to the socket.
|
||||
oldmask := syscall.Umask(0o077)
|
||||
unixListener, err = net.ListenUnix("unix", unixAddr)
|
||||
syscall.Umask(oldmask)
|
||||
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