mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 20:04:02 +03:00
Fix all lint errors
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user