Skip to content

Commit a63fd95

Browse files
committed
Update libs
1 parent 543eff9 commit a63fd95

File tree

6 files changed

+21
-22
lines changed

6 files changed

+21
-22
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/ssh_data/
2+
.git/
3+
.github/
4+
.vscode/
5+
.coverage.out

.vscode/launch.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"type": "go",
1010
"request": "launch",
1111
"mode": "auto",
12-
"program": "${workspaceFolder}/cmd/authorized_keys/main.go",
12+
"program": "${workspaceFolder}/cmd/example/main.go",
1313
"cwd": "${workspaceFolder}",
1414
"buildFlags": [
1515
"-race"

Dockerfile

+13-1
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,28 @@ RUN --mount=type=cache,target=/go/pkg/,rw \
1010
--mount=type=cache,target=/root/.cache/,rw \
1111
go mod download
1212

13+
WORKDIR /usr/src/app/cmd/example
14+
15+
COPY ./cmd/example/go.* .
16+
17+
RUN --mount=type=cache,target=/go/pkg/,rw \
18+
--mount=type=cache,target=/root/.cache/,rw \
19+
go mod download
20+
21+
WORKDIR /usr/src/app
22+
1323
COPY . .
1424

1525
ARG TARGETOS
1626
ARG TARGETARCH
1727

1828
ENV GOOS=${TARGETOS} GOARCH=${TARGETARCH}
1929

30+
WORKDIR /usr/src/app/cmd/example
31+
2032
RUN --mount=type=cache,target=/go/pkg/,rw \
2133
--mount=type=cache,target=/root/.cache/,rw \
22-
go build -o pubsub ./cmd/authorized_keys
34+
go build -o /usr/src/app/pubsub ./
2335

2436
FROM alpine
2537

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Using `wish` we can integrate our pubsub system into an SSH app.
1414
# term 1
1515
mkdir ./ssh_data
1616
cat ~/.ssh/id_ed25519 ./ssh_data/authorized_keys
17-
go run ./cmd/authorized_keys
17+
go run ./cmd/example
1818

1919
# term 2
2020
ssh -p 2222 localhost sub xyz

cmd/example/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package example
1+
package main
22

33
import (
44
"context"

log/log.go

-18
Original file line numberDiff line numberDiff line change
@@ -339,24 +339,6 @@ func SendLogRegister(logger *slog.Logger, connectionInfo *PubSubConnectionInfo,
339339
var _ io.Writer = (*PubSubLogWriter)(nil)
340340
var _ slog.Handler = (*MultiHandler)(nil)
341341

342-
func AnyToStr(mp map[string]any, key string) string {
343-
if value, ok := mp[key]; ok {
344-
if value, ok := value.(string); ok {
345-
return value
346-
}
347-
}
348-
return ""
349-
}
350-
351-
func AnyToFloat(mp map[string]any, key string) float64 {
352-
if value, ok := mp[key]; ok {
353-
if value, ok := value.(float64); ok {
354-
return value
355-
}
356-
}
357-
return 0
358-
}
359-
360342
func ConnectToLogs(ctx context.Context, connectionInfo *PubSubConnectionInfo) (io.Reader, error) {
361343
sshClient, err := CreateSSHClient(connectionInfo)
362344
if err != nil {

0 commit comments

Comments
 (0)