Fix lint errors

This commit is contained in:
9seconds
2018-07-09 16:11:05 +03:00
parent fb00cd1121
commit 29b5130c95
32 changed files with 207 additions and 55 deletions
+7
View File
@@ -8,6 +8,8 @@ import (
"go.uber.org/zap"
)
// StreamCipher is a wrapper which encrypts/decrypts stream with AES-CTR
// (as a part of obfuscated2 protocol).
type StreamCipher struct {
encryptor cipher.Stream
decryptor cipher.Stream
@@ -32,22 +34,27 @@ func (s *StreamCipher) Write(p []byte) (int, error) {
return s.conn.Write(encrypted)
}
// Logger returns an instance of the logger for this wrapper.
func (s *StreamCipher) Logger() *zap.SugaredLogger {
return s.logger
}
// LocalAddr returns local address of the underlying net.Conn.
func (s *StreamCipher) LocalAddr() *net.TCPAddr {
return s.conn.LocalAddr()
}
// RemoteAddr returns remote address of the underlying net.Conn.
func (s *StreamCipher) RemoteAddr() *net.TCPAddr {
return s.conn.RemoteAddr()
}
// Close closes underlying net.Conn instance.
func (s *StreamCipher) Close() error {
return s.conn.Close()
}
// NewStreamCipher creates new stream cipher wrapper.
func NewStreamCipher(conn StreamReadWriteCloser, encryptor, decryptor cipher.Stream) StreamReadWriteCloser {
return &StreamCipher{
conn: conn,