Skip to content

Commit 3159120

Browse files
committed
Initial commit
0 parents  commit 3159120

File tree

15 files changed

+978
-0
lines changed

15 files changed

+978
-0
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: ["master"]
6+
pull_request:
7+
branches: ["master"]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version-file: "go.mod"
20+
21+
- name: Build
22+
run: go build -v ./...
23+
24+
- name: Test
25+
run: go test -v ./...

.github/workflows/release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
ubuntu-build:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: write
14+
packages: write
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version-file: "go.mod"
23+
24+
- name: Set up Docker
25+
uses: docker/setup-docker-action@v4
26+
with:
27+
daemon-config: |
28+
{
29+
"features": {
30+
"containerd-snapshotter": true
31+
}
32+
}
33+
34+
- name: Set up QEMU
35+
uses: docker/setup-qemu-action@v3
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
40+
- name: Login to GitHub Container Registry
41+
uses: docker/login-action@v3
42+
with:
43+
registry: ghcr.io
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Run GoReleaser
48+
uses: goreleaser/goreleaser-action@v6
49+
with:
50+
args: release --clean
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
SCOOP_BUCKET_PUSH_TOKEN: ${{ secrets.SCOOP_BUCKET_PUSH_TOKEN }}
54+
HOMEBREW_TAP_PUSH_TOKEN: ${{ secrets.HOMEBREW_TAP_PUSH_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/sshgate
2+
/dist

.goreleaser.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: 2
2+
3+
builds:
4+
- ldflags: "-s -w"
5+
flags:
6+
- -trimpath
7+
env:
8+
- CGO_ENABLED=0
9+
goos:
10+
- darwin
11+
- linux
12+
- windows
13+
goarch:
14+
- amd64
15+
- arm64
16+
17+
dockers:
18+
- build_flag_templates:
19+
- "--platform=linux/arm64,linux/amd64"
20+
image_templates:
21+
- ghcr.io/cedws/sshgate:latest
22+
- ghcr.io/cedws/sshgate:{{ .Tag }}
23+
24+
scoops:
25+
- name: sshgate
26+
repository:
27+
name: scoop-bucket
28+
owner: cedws
29+
token: "{{ .Env.SCOOP_BUCKET_PUSH_TOKEN }}"
30+
31+
homebrew_casks:
32+
- name: sshgate
33+
repository:
34+
name: homebrew-tap
35+
owner: cedws
36+
token: "{{ .Env.HOMEBREW_TAP_PUSH_TOKEN }}"
37+
custom_block: |
38+
binary "sshgate", target: "age-plugin-sshgate"
39+
hooks:
40+
post:
41+
install: |
42+
if system_command("/usr/bin/xattr", args: ["-h"]).exit_status == 0
43+
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/sshgate"]
44+
end
45+
46+
changelog:
47+
use: github-native

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM scratch
2+
ENTRYPOINT ["/sshgate"]
3+
COPY sshgate /

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# sshgate

examples/config.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"identities": [
3+
{
4+
"authorized_keys": ["..."],
5+
"rules": [
6+
{
7+
"hosts": ["github.com"],
8+
"ports": [22]
9+
}
10+
]
11+
}
12+
]
13+
}

go.mod

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module github.com/cedws/sshgate
2+
3+
go 1.25.0
4+
5+
require (
6+
github.com/alecthomas/assert/v2 v2.11.0
7+
github.com/alecthomas/kong v1.12.1
8+
golang.org/x/crypto v0.41.0
9+
)
10+
11+
require (
12+
github.com/alecthomas/repr v0.4.0 // indirect
13+
github.com/hexops/gotextdiff v1.0.3 // indirect
14+
golang.org/x/sys v0.35.0 // indirect
15+
)

go.sum

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
2+
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
3+
github.com/alecthomas/kong v1.12.1 h1:iq6aMJDcFYP9uFrLdsiZQ2ZMmcshduyGv4Pek0MQPW0=
4+
github.com/alecthomas/kong v1.12.1/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU=
5+
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
6+
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
7+
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
8+
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
9+
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
10+
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
11+
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
12+
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
13+
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
14+
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=

main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main
2+
3+
import (
4+
"github.com/cedws/sshgate/pkg/cmd"
5+
)
6+
7+
func main() {
8+
cmd.Execute()
9+
}

0 commit comments

Comments
 (0)