mirror of
https://github.com/SagerNet/sing-shadowsocks.git
synced 2025-04-03 20:07:40 +03:00
Add linter
This commit is contained in:
parent
689e0165ef
commit
ad926ed792
13 changed files with 119 additions and 23 deletions
|
@ -97,6 +97,9 @@ func (s *Service) newConnection(ctx context.Context, conn net.Conn, metadata M.M
|
|||
readCipher, err := s.constructor(key.Bytes())
|
||||
key.Release()
|
||||
common.KeepAlive(_key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
reader := NewReader(conn, readCipher, MaxPacketSize)
|
||||
|
||||
err = reader.ReadWithLengthChunk(header.From(s.keySaltLength))
|
||||
|
@ -264,6 +267,9 @@ func (w *serverPacketWriter) WritePacket(buffer *buf.Buffer, destination M.Socks
|
|||
writeCipher, err := w.constructor(key.Bytes())
|
||||
key.Release()
|
||||
common.KeepAlive(_key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
writeCipher.Seal(buffer.From(w.keySaltLength)[:0], rw.ZeroBytes[:writeCipher.NonceSize()], buffer.From(w.keySaltLength), nil)
|
||||
buffer.Extend(Overhead)
|
||||
return w.source.WritePacket(buffer, M.SocksaddrFromNet(w.nat.LocalAddr()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue