feat: Support ShadowTLS v2 as Shadowsocks plugin (#330)

This commit is contained in:
3andero
2023-01-10 08:10:39 -08:00
committed by metacubex
parent 337be9124f
commit 51f9b34a7c
7 changed files with 206 additions and 20 deletions

View File

@ -109,7 +109,12 @@ func (to *TLSObfs) write(b []byte) (int, error) {
binary.Write(buf, binary.BigEndian, uint16(len(b)))
buf.Write(b)
_, err := to.Conn.Write(buf.Bytes())
return len(b), err
if err != nil {
// return 0 because errors occur here make the
// whole situation irrecoverable
return 0, err
}
return len(b), nil
}
// NewTLSObfs return a SimpleObfs