优化连接管理和日志记录
This commit is contained in:
@@ -335,13 +335,14 @@ func sendReply(w io.Writer, resp uint8, addr *AddrSpec) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func SendSuccess(user net.Conn, target net.Conn) {
|
||||
func SendSuccess(user net.Conn, target net.Conn) error {
|
||||
local := target.LocalAddr().(*net.TCPAddr)
|
||||
bind := AddrSpec{IP: local.IP, Port: local.Port}
|
||||
err := sendReply(user, successReply, &bind)
|
||||
if err != nil {
|
||||
slog.Error("Failed to send reply", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ProxyConn struct {
|
||||
|
||||
Reference in New Issue
Block a user