Fixed code smells

This commit is contained in:
2025-10-09 12:18:14 +02:00
parent 45e6800e82
commit 83a029a694
5 changed files with 9 additions and 9 deletions

View File

@@ -40,16 +40,16 @@ func main() {
c = protocol.Limit(c, func(dir protocol.Direction, p *protocol.Protocol) error {
if p == nil {
return errors.New("No protocol detected")
return errors.New("no protocol detected")
}
if !accept[p.Name] {
return fmt.Errorf("Protocol %s is not accepted", p.Name)
return fmt.Errorf("protocol %s is not accepted", p.Name)
}
fmt.Fprintf(os.Stderr, "Accepting protocol %s version %s initiated by %s\n",
p.Name, p.Version, dir)
return nil
})
defer c.Close()
defer func() { _ = c.Close() }()
var wait sync.WaitGroup
wait.Go(func() { multiplex(c, os.Stdin) })

View File

@@ -72,8 +72,8 @@ func proxy(client net.Conn, target string) {
// Create a wait group and copy between client and server bidirectionally,
// either side needs to generate data for the detection to work.
var group sync.WaitGroup
group.Go(func() { io.Copy(client, server) })
group.Go(func() { io.Copy(server, client) })
group.Go(func() { _, _ = io.Copy(client, server) })
group.Go(func() { _, _ = io.Copy(server, client) })
// Wait until the interceptor produces data.
result := <-intercepted