Skip to content

Commit

Permalink
fix ci errors
Browse files Browse the repository at this point in the history
  • Loading branch information
0pcom committed Jun 14, 2024
1 parent 2764434 commit fbe08b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions cmd/dmsgweb/commands/dmsgweb.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,19 +226,19 @@ dmsgweb conf file detected: ` + dmsgwebconffile
}

if rawTCP {
proxyTCPConn(localPort[0], dmsgC, dmsgWebLog)
proxyTCPConn(dmsgC, dmsgWebLog)
}
// if rawUDP {
// proxyUDPConn(localPort[0], dmsgC, dmsgWebLog)
// proxyUDPConn(dmsgC, dmsgWebLog)
// }
if !rawTCP && !rawUDP {
proxyHTTPConn(localPort[0], dmsgWebLog)
proxyHTTPConn(dmsgWebLog)
}
wg.Wait()
},
}

func proxyHTTPConn(localPort uint, log *logging.Logger) {
func proxyHTTPConn(log *logging.Logger) {

Check failure on line 241 in cmd/dmsgweb/commands/dmsgweb.go

View workflow job for this annotation

GitHub Actions / linux

unused-parameter: parameter 'log' seems to be unused, consider removing or renaming it as _ (revive)
r := gin.New()

r.Use(gin.Recovery())
Expand Down Expand Up @@ -307,13 +307,13 @@ func proxyHTTPConn(localPort uint, log *logging.Logger) {
wg.Done()
}()
}
func proxyTCPConn(webPort uint, dmsgC *dmsg.Client, log *logging.Logger) {
func proxyTCPConn(dmsgC *dmsg.Client, log *logging.Logger) {
// Start listening on the specified local port
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", webPort))
if err != nil {
log.Fatalf("Failed to start TCP listener on port %d: %v", webPort, err)
}
defer listener.Close()
defer listener.Close() //nolint
log.Printf("Serving TCP on 127.0.0.1:%d", webPort)

// Accept incoming TCP connections and proxy them
Expand All @@ -327,7 +327,7 @@ func proxyTCPConn(webPort uint, dmsgC *dmsg.Client, log *logging.Logger) {
wg.Add(1)
go func(conn net.Conn) {
defer wg.Done()
defer conn.Close()
defer conn.Close() //nolint

var dialPort uint64
if len(dmsgAddr) > 1 {
Expand All @@ -346,7 +346,7 @@ func proxyTCPConn(webPort uint, dmsgC *dmsg.Client, log *logging.Logger) {
log.Printf("Failed to dial dmsg address %s: %v", resolveDmsgAddr, err)
return
}
defer dmsgConn.Close()
defer dmsgConn.Close() //nolint

// Proxy data from TCP connection to dmsg connection
go func() {
Expand All @@ -355,7 +355,7 @@ func proxyTCPConn(webPort uint, dmsgC *dmsg.Client, log *logging.Logger) {
log.Printf("Error copying data to dmsg server: %v", err)
}
// Close dmsgConn after copying is done
dmsgConn.Close()
dmsgConn.Close() //nolint
}()

// Proxy data from dmsg connection to TCP connection
Expand All @@ -365,7 +365,7 @@ func proxyTCPConn(webPort uint, dmsgC *dmsg.Client, log *logging.Logger) {
log.Printf("Error copying data from dmsg server: %v", err)
}
// Close conn after copying is done
conn.Close()
conn.Close() //nolint
}()
}(conn)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/dmsgweb/commands/dmsgwebsrv.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ func proxyTCPConnections(localPort uint, lis net.Listener, log *logging.Logger)
}

func handleTCPConnection(dmsgConn net.Conn, localPort uint, log *logging.Logger) {
defer dmsgConn.Close()
defer dmsgConn.Close() //nolint

localConn, err := net.Dial("tcp", fmt.Sprintf("127.0.0.1:%d", localPort))
if err != nil {
log.Printf("Error connecting to local port %d: %v", localPort, err)
return
}
defer localConn.Close()
defer localConn.Close() //nolint

copyConn := func(dst net.Conn, src net.Conn) {
_, err := io.Copy(dst, src)
Expand Down

0 comments on commit fbe08b1

Please sign in to comment.