Skip to content

Commit 73550ff

Browse files
committed
chore(go): fix lint
1 parent 41a86a0 commit 73550ff

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

.github/workflows/golang.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
file: ./Dockerfile
8989
platforms: linux/amd64,linux/arm64
9090
push: false
91-
tags: ghcr.io/darkness4/dpsproxy-server:latest
91+
tags: ghcr.io/deepsquare-io/dpsproxy-server:latest
9292
build-args: |
9393
VERSION=dev
9494
cache-from: type=gha
@@ -118,9 +118,9 @@ jobs:
118118
platforms: linux/amd64,linux/arm64
119119
push: true
120120
tags: |
121-
ghcr.io/darkness4/dpsproxy-server:latest
122-
ghcr.io/darkness4/dpsproxy-server:dev
123-
ghcr.io/darkness4/dpsproxy-server:${{ steps.get_version.outputs.VERSION }}
121+
ghcr.io/deepsquare-io/dpsproxy-server:latest
122+
ghcr.io/deepsquare-io/dpsproxy-server:dev
123+
ghcr.io/deepsquare-io/dpsproxy-server:${{ steps.get_version.outputs.VERSION }}
124124
build-args: |
125125
${{ steps.get_version.outputs.VERSION }}
126126
cache-from: type=gha

cmd/dpsproxy-server/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/*
2-
Auth Web3 HTMX is a simple demonstration of Web3 in combination with HTMX, written in Go.
3-
*/package main
1+
package main
42

53
import (
64
"context"

cmd/dpsproxy/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ var app = &cli.App{
7676
if reconnect {
7777
if errors.Is(err, io.EOF) {
7878
return nil
79-
} else {
80-
log.Err(err).Msg("client failure")
8179
}
80+
log.Err(err).Msg("client failure")
8281
select {
8382
case <-time.After(time.Second * 10):
8483
continue

ssh/server.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,10 @@ func (c *client) handleTCPIPForward(
306306
if errors.As(err, &netErr) && netErr.Timeout() {
307307
c.log.Warn().Err(err).Msg("accept failed with timeout")
308308
continue
309-
} else {
310-
c.log.Warn().Err(err).Msg("accept failed")
311-
312-
return err
313309
}
310+
c.log.Warn().Err(err).Msg("accept failed")
311+
312+
return err
314313
}
315314

316315
go func() {
@@ -382,6 +381,8 @@ func (c *client) pipe(ctx context.Context, ch ssh.Channel, conn net.Conn) error
382381
return ctx.Err()
383382
}
384383

384+
// ForwardHTTP is a middleware that forwards HTTP request based on the subdomain
385+
// to a corresponding SSH client.
385386
func (s *Server) ForwardHTTP(next http.Handler) http.Handler {
386387
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
387388
host, _, err := net.SplitHostPort(r.Host)

utils/generate_port.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@ const maxPort = 60000
88
const safeMinPort = 60001
99
const safeMaxPort = 65535
1010

11+
// GenerateRandomPort generates a random port in a range.
1112
func GenerateRandomPort() int64 {
1213
return rand.Int63n(maxPort-minPort+1) + minPort
1314
}
1415

16+
// GenerateSafeRandomPort generates a random port in a safe range.
1517
func GenerateSafeRandomPort() int64 {
1618
return rand.Int63n(safeMaxPort-safeMinPort+1) + safeMinPort
1719
}
1820

1921
const subdomainLength = 10
2022

23+
// GenerateSubdomain generates a random subdomain
2124
func GenerateSubdomain() string {
2225
// Define the character set for the subdomain
2326
charSet := "abcdefghijklmnopqrstuvwxyz0123456789"

0 commit comments

Comments
 (0)