feat: reduce log of use of closed network connection

This commit is contained in:
SunBK201 2023-12-09 21:11:47 +08:00
parent cb532c55d2
commit 634925e7e0
24 changed files with 28 additions and 21 deletions

View File

@ -1,10 +1,10 @@
0f6211146be2756456d875b08c118507 ./ua3f-0.1.0-386.tar.gz
1c3045a4dd96e5539e167377cb1714af ./ua3f-0.1.0-amd64.tar.gz
a56e07f9e99c75b7c80e182db7f469f4 ./ua3f-0.1.0-arm.tar.gz
ab08b81c4698d7e76a9a4ba8008e8787 ./ua3f-0.1.0-arm64.tar.gz
ab08b81c4698d7e76a9a4ba8008e8787 ./ua3f-0.1.0-armv8.tar.gz
1ccadf573d3d3b229c6a41af88a715cd ./ua3f-0.1.0-mips64.tar.gz
20f433bd1572ec219a18ec9fd7e9377a ./ua3f-0.1.0-mipsle-hardfloat.tar.gz
507b3477b94352638accdfa8f9f211ca ./ua3f-0.1.0-mipsle-softfloat.tar.gz
d3f018d414310a0e116674ad14b19a62 ./ua3f-0.1.0-mipsle.tar.gz
f017636a3c599c9ec0e7e8b2432c07dc ./ua3f-0.1.0-riscv64.tar.gz
5a75ec8000a8b3593a853c12863e2b46 ./ua3f-0.1.1-386.tar.gz
85cce8bd5d2aef5d8481cfe6f1f9b099 ./ua3f-0.1.1-amd64.tar.gz
4bfe414dd58e2eeb57e3381cbada7a2b ./ua3f-0.1.1-arm.tar.gz
da1d3a054e66d5680a38a3ffcb67862a ./ua3f-0.1.1-arm64.tar.gz
da1d3a054e66d5680a38a3ffcb67862a ./ua3f-0.1.1-armv8.tar.gz
02fe1c3c18115dcecf4bf38f62e5de83 ./ua3f-0.1.1-mips64.tar.gz
69d64e2f443859418f74749e7d02e018 ./ua3f-0.1.1-mipsle-hardfloat.tar.gz
23781cf6da653e6bfd40c91ccb258885 ./ua3f-0.1.1-mipsle-softfloat.tar.gz
41b823964a881b5e2c429e785287e4e4 ./ua3f-0.1.1-mipsle.tar.gz
4319b5e0e69bf2637a33ca6aee3ed284 ./ua3f-0.1.1-riscv64.tar.gz

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/ua3f-0.1.1-386.tar.gz Normal file

Binary file not shown.

BIN
bin/ua3f-0.1.1-amd64.tar.gz Normal file

Binary file not shown.

BIN
bin/ua3f-0.1.1-arm.tar.gz Normal file

Binary file not shown.

BIN
bin/ua3f-0.1.1-arm64.tar.gz Normal file

Binary file not shown.

BIN
bin/ua3f-0.1.1-armv8.tar.gz Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
#!/bin/sh
project_name="ua3f"
release_version="0.1.0"
release_version="0.1.1"
target=cmd/ua3f.go
release_dir=./bin

View File

@ -16,7 +16,7 @@ import (
"github.com/sirupsen/logrus"
)
var version = "0.1.0"
var version = "0.1.1"
var payloadByte []byte
var cache *expirable.LRU[string, string]
@ -137,10 +137,12 @@ func Socks5Connect(client net.Conn) (net.Conn, error) {
}
port := binary.BigEndian.Uint16(buf[:2])
destAddrPort := fmt.Sprintf("%s:%d", addr, port)
logrus.Debug(fmt.Sprintf("Connecting %s", destAddrPort))
dest, err := net.Dial("tcp", destAddrPort)
if err != nil {
return nil, errors.New("dial dst:" + err.Error())
}
logrus.Debug(fmt.Sprintf("Connected %s", destAddrPort))
_, err = client.Write([]byte{0x05, 0x00, 0x00, 0x01, 0, 0, 0, 0, 0, 0})
if err != nil {
dest.Close()
@ -199,7 +201,7 @@ func CopyPileline(dst io.Writer, src io.Reader) {
var m int
m, err = src.Read(buf[nr:])
if err != nil {
logrus.Error("read error: ", err)
logrus.Error("read error in http accumulation: ", err)
break
}
nr += m
@ -239,12 +241,12 @@ func CopyPileline(dst io.Writer, src io.Reader) {
for left > 0 {
m, err := src.Read(buf[0:left])
if err != nil {
logrus.Error("read error: ", err)
logrus.Error("read error in large body: ", err)
break
}
_, ew := dst.Write(buf[0:m])
if ew != nil {
logrus.Error("write error: ", ew)
logrus.Error("write error in large body: ", ew)
break
}
left -= m
@ -259,11 +261,14 @@ func CopyPileline(dst io.Writer, src io.Reader) {
m, err := src.Read(buf[nr:])
nr += m
if err != nil && err != io.EOF {
logrus.Error("read error: ", err)
break
}
if err == io.EOF {
if err != nil {
if err == io.EOF {
logrus.Debug("read EOF in next phase")
} else if strings.Contains(err.Error(), "use of closed network connection") {
logrus.Debug("read closed in next phase: ", err)
} else {
logrus.Error("read error in next phase: ", err)
}
break
}
}

View File

@ -16,11 +16,12 @@ getcpucore() {
cd /root
getcpucore
version=0.1.0
version=0.1.1
ua3f_tar=ua3f-$version-$cpucore.tar.gz
if [ -f "ua3f" ]; then
rm "ua3f"
killall ua3f >/dev/null 2>&1
fi
chmod ugo+w /var/log
@ -53,4 +54,5 @@ mv ua3f.service /etc/init.d/ && chmod +x /etc/init.d/ua3f.service
if [ $? -eq 0 ]; then
echo "Install UA3F Success."
echo "Use /etc/init.d/ua3f.service {start|stop|restart} to control UA3F."
fi