adapt newest go-shadowsocks2 lib

This commit is contained in:
kLiHz
2026-04-15 07:00:21 +08:00
committed by RMT
parent 70dee081a4
commit 3c8995027a
7 changed files with 232 additions and 325 deletions
+9 -2
View File
@@ -34,9 +34,16 @@ func (c *shadowConn) Write(b []byte) (n int, err error) {
n = len(b) // force byte length consistent
if c.wbuf.Len() > 0 {
c.wbuf.Write(b) // append the data to the cached header
_, err = c.Conn.Write(c.wbuf.Bytes())
written, err := c.Conn.Write(c.wbuf.Bytes())
if err != nil {
// If short write, keep unwritten bytes
if written > 0 && written < c.wbuf.Len() {
c.wbuf.Next(written)
}
return written, err
}
c.wbuf.Reset()
return
return n, nil
}
_, err = c.Conn.Write(b)
return