Fix all lint errors

This commit is contained in:
9seconds
2018-05-31 09:54:20 +03:00
parent 42e5be36bf
commit 4ad913add2
12 changed files with 101 additions and 47 deletions
+5
View File
@@ -2,24 +2,29 @@ package proxy
import "io"
// TrafficReadWriteCloser counts an amount of ingress/egress traffic by
// calling given callbacks.
type TrafficReadWriteCloser struct {
conn io.ReadWriteCloser
readCallback func(int)
writeCallback func(int)
}
// Read reads from connection
func (t *TrafficReadWriteCloser) Read(p []byte) (n int, err error) {
n, err = t.conn.Read(p)
t.readCallback(n)
return
}
// Write writes into connection.
func (t *TrafficReadWriteCloser) Write(p []byte) (n int, err error) {
n, err = t.conn.Write(p)
t.writeCallback(n)
return
}
// Close closes underlying connection.
func (t *TrafficReadWriteCloser) Close() error {
return t.conn.Close()
}