Suppress connection end log output

This is an amendment of https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/30
This commit is contained in:
Shelikhoo 2022-01-06 20:31:15 +00:00 committed by Cecylia Bocovich
parent b35a79ac24
commit 50646698e3
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90
2 changed files with 5 additions and 3 deletions

View file

@ -3,6 +3,7 @@
package main
import (
"errors"
"flag"
"fmt"
"io"
@ -47,7 +48,7 @@ func proxy(local *net.TCPConn, conn net.Conn) {
wg.Add(2)
go func() {
if _, err := io.Copy(conn, local); err != nil && err != io.ErrClosedPipe {
if _, err := io.Copy(conn, local); err != nil && !errors.Is(err, io.ErrClosedPipe) {
log.Printf("error copying ORPort to WebSocket %v", err)
}
local.CloseRead()
@ -55,7 +56,7 @@ func proxy(local *net.TCPConn, conn net.Conn) {
wg.Done()
}()
go func() {
if _, err := io.Copy(local, conn); err != nil && err != io.ErrClosedPipe {
if _, err := io.Copy(local, conn); err != nil && !errors.Is(err, io.ErrClosedPipe) {
log.Printf("error copying WebSocket to ORPort %v", err)
}
local.CloseWrite()