fix: log output

This commit is contained in:
SunBK201 2024-03-18 21:46:50 +08:00
parent 6e7f549adf
commit 101e42fd6c
27 changed files with 26 additions and 25 deletions

View File

@ -1,11 +1,11 @@
2e956b0acef25c77b05862242e00e839 ./ua3f-0.3.0-386.tar.gz
0365ecb622ad8767b61338de24a94eb0 ./ua3f-0.3.0-amd64.tar.gz
b17d821a1e59baba0a169e94e14aa719 ./ua3f-0.3.0-arm.tar.gz
651e4b7e66650b967e0a6a6af00e7201 ./ua3f-0.3.0-arm64.tar.gz
76f927277bb20b89253e0fe70e8d53c4 ./ua3f-0.3.0-armv7.tar.gz
651e4b7e66650b967e0a6a6af00e7201 ./ua3f-0.3.0-armv8.tar.gz
ddc6d9ad7c3171dc5a972c3c83aa670e ./ua3f-0.3.0-mips64.tar.gz
cdbc9b71b1f7daed024e98703e0aa9c1 ./ua3f-0.3.0-mipsle-hardfloat.tar.gz
3c514bb0c3a72bc5a89045328746576f ./ua3f-0.3.0-mipsle-softfloat.tar.gz
ec9e3671cdeedd9150724968689e3afc ./ua3f-0.3.0-mipsle.tar.gz
37b6239381190e8dbc695e6f8b08cbf8 ./ua3f-0.3.0-riscv64.tar.gz
ec6674f7b826657c6e76ee4d438d605f ./ua3f-0.3.1-386.tar.gz
17d7d471b509b649faffa30212de67e0 ./ua3f-0.3.1-amd64.tar.gz
e4bc4bb914ef6a4f48aac85be6e761ca ./ua3f-0.3.1-arm.tar.gz
056e2b39ca2f1c3378b75bfa2243e3ba ./ua3f-0.3.1-arm64.tar.gz
f23ec84c3f8dfd1e1861ae75508e8a46 ./ua3f-0.3.1-armv7.tar.gz
056e2b39ca2f1c3378b75bfa2243e3ba ./ua3f-0.3.1-armv8.tar.gz
784ce20b7c1e6127d51598a134106abd ./ua3f-0.3.1-mips64.tar.gz
de61b985103b162ee390fb2db1604c6e ./ua3f-0.3.1-mipsle-hardfloat.tar.gz
de1fec881e9e489c07817f9c39030f26 ./ua3f-0.3.1-mipsle-softfloat.tar.gz
ab1571905d37340c674cf5543c77d625 ./ua3f-0.3.1-mipsle.tar.gz
338b1c46b464da264529ebb8917fd6ba ./ua3f-0.3.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.

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

BIN
bin/ua3f-0.3.1-armv7.tar.gz Normal file

Binary file not shown.

BIN
bin/ua3f-0.3.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.3.0"
release_version="0.3.1"
target=cmd/ua3f.go
release_dir=./bin

View File

@ -17,7 +17,7 @@ import (
"github.com/sirupsen/logrus"
)
var version = "0.3.0"
var version = "0.3.1"
var payloadByte []byte
var cache *expirable.LRU[string, string]
var HTTP_METHOD = []string{"GET", "POST", "HEAD", "PUT", "DELETE", "OPTIONS", "TRACE", "CONNECT"}
@ -96,6 +96,9 @@ func process(client net.Conn) {
Socks5UDP(client)
client.Close()
return
} else if strings.Contains(err.Error(), "connection timed out") {
logrus.Debug("Connect timeout: ", err)
return
}
logrus.Error("Connect failed: ", err)
client.Close()
@ -185,13 +188,11 @@ func Socks5UDP(client net.Conn) {
logrus.Debug(fmt.Sprintf("[%s][UDP] ReadFromUDP failed: %s", client.RemoteAddr().String(), err.Error()))
if !isAlive(client) {
logrus.Debug(fmt.Sprintf("[%s][UDP] client is not alive", client.RemoteAddr().String()))
udpserver.Close()
return
break
}
} else {
logrus.Error(fmt.Sprintf("[%s][UDP] ReadFromUDP failed: %s", client.RemoteAddr().String(), err.Error()))
}
continue
}
if clientAddr == nil {
@ -220,7 +221,7 @@ func Socks5UDP(client net.Conn) {
targetIPaddr, err := net.ResolveIPAddr("ip", targetAddr)
if err != nil {
logrus.Error(fmt.Sprintf("[%s][UDP] ResolveIPAddr failed: %s", client.RemoteAddr().String(), err.Error()))
continue
break
}
targetIP = targetIPaddr.IP
targetPort = binary.BigEndian.Uint16(buf[5+addrLen : 5+addrLen+2])
@ -228,10 +229,10 @@ func Socks5UDP(client net.Conn) {
header = buf[0 : 5+addrLen+2]
} else if atyp == 4 {
logrus.Error(fmt.Sprintf("[%s][UDP] IPv6: no supported yet", client.RemoteAddr().String()))
continue
break
} else {
logrus.Error(fmt.Sprintf("[%s][UDP] invalid atyp", client.RemoteAddr().String()))
continue
break
}
// targetAddrPort := fmt.Sprintf("%s:%d", targetAddr, targetPort)
remoteAddr := &net.UDPAddr{IP: targetIP, Port: int(targetPort)}
@ -239,12 +240,11 @@ func Socks5UDP(client net.Conn) {
copy(udpPortMap[remoteAddr.String()], header)
udpserver.SetWriteDeadline(time.Now().Add(time.Second * 10))
if _, err = udpserver.WriteToUDP(payload, remoteAddr); err != nil {
logrus.Error(fmt.Sprintf("[%s][UDP] WriteToUDP failed: %s", client.RemoteAddr().String(), err.Error()))
logrus.Debug(fmt.Sprintf("[%s][UDP] WriteToUDP to remote failed: %s", client.RemoteAddr().String(), err.Error()))
continue
}
} else {
// from remote
fmt.Print(fromAddr.String())
header := udpPortMap[fromAddr.String()]
if header == nil {
logrus.Error(fmt.Sprintf("[%s][UDP] udpPortMap invalid header", client.RemoteAddr().String()))
@ -256,11 +256,12 @@ func Socks5UDP(client net.Conn) {
}
body := append(header, buf[:n]...)
if _, err = udpserver.WriteToUDP(body, clientAddr); err != nil {
logrus.Error(fmt.Sprintf("[%s][UDP] WriteToUDP failed: %s", client.RemoteAddr().String(), err.Error()))
logrus.Debug(fmt.Sprintf("[%s][UDP] WriteToUDP to client failed: %s", client.RemoteAddr().String(), err.Error()))
continue
}
}
}
udpserver.Close()
}
func Socks5Connect(client net.Conn) (net.Conn, string, error) {
@ -417,7 +418,7 @@ func CopyPileline(dst io.Writer, src io.Reader, destAddrPort string) {
var m int
m, err = src.Read(buf[nr:])
if err != nil {
logrus.Error(fmt.Sprintf("[%s] read error in http accumulation: %v", destAddrPort, err))
logrus.Debug(fmt.Sprintf("[%s] read error in http accumulation: %v", destAddrPort, err))
break
}
nr += m

View File

@ -20,7 +20,7 @@ ckcmd() {
cd /root
getcpucore
version=0.3.0
version=0.3.1
ua3f_tar=ua3f-$version-$cpucore.tar.gz
if id -u shellclash >/dev/null 2>&1; then

View File

@ -3,7 +3,7 @@ local uci = require("luci.model.uci").cursor()
ua3f = Map("ua3f",
"UA3F",
[[
<a href="https://github.com/SunBK201/UA3F" target="_blank">Version: 0.3.0</a>
<a href="https://github.com/SunBK201/UA3F" target="_blank">Version: 0.3.1</a>
<br>
Across the Campus we can reach every corner in the world.
]]