diff --git a/utils/ioplus/reader.go b/utils/ioplus/reader.go index 76c6015..06444b3 100644 --- a/utils/ioplus/reader.go +++ b/utils/ioplus/reader.go @@ -7,7 +7,7 @@ import ( type SReadCloser struct { r io.Reader - bytes int + Bytes int start time.Time lastCalc time.Time speed int @@ -15,7 +15,7 @@ type SReadCloser struct { func (s *SReadCloser) Read(data []byte) (n int, err error) { n, err = s.r.Read(data) - s.bytes += n + s.Bytes += n now := time.Now() elapsed := now.Sub(s.lastCalc).Seconds() if elapsed >= 1 { @@ -30,7 +30,7 @@ func (s *SReadCloser) Speed() int { } func (s *SReadCloser) Average() float64 { - return float64(s.bytes) / s.start.Sub(s.lastCalc).Seconds() + return float64(s.Bytes) / s.start.Sub(s.lastCalc).Seconds() } func (s *SReadCloser) Bind(r io.Reader) io.Reader { diff --git a/utils/ioplus/writer.go b/utils/ioplus/writer.go index 05a6d2a..11c726b 100644 --- a/utils/ioplus/writer.go +++ b/utils/ioplus/writer.go @@ -7,7 +7,7 @@ import ( type SWrite struct { w io.Writer - bytes int + Bytes int start time.Time lastCalc time.Time speed int @@ -15,7 +15,7 @@ type SWrite struct { func (s *SWrite) Write(data []byte) (n int, err error) { n, err = s.w.Write(data) - s.bytes += n + s.Bytes += n now := time.Now() elapsed := now.Sub(s.lastCalc).Seconds() if elapsed >= 1 { @@ -30,7 +30,7 @@ func (s *SWrite) Speed() int { } func (s *SWrite) Average() float64 { - return float64(s.bytes) / s.start.Sub(s.lastCalc).Seconds() + return float64(s.Bytes) / s.start.Sub(s.lastCalc).Seconds() } func (s *SWrite) Bind(w io.Writer) io.Writer {