debug.go 360 B

123456789101112131415161718192021
  1. package ftp
  2. import "io"
  3. type debugWrapper struct {
  4. conn io.ReadWriteCloser
  5. io.Reader
  6. io.Writer
  7. }
  8. func newDebugWrapper(conn io.ReadWriteCloser, w io.Writer) io.ReadWriteCloser {
  9. return &debugWrapper{
  10. Reader: io.TeeReader(conn, w),
  11. Writer: io.MultiWriter(w, conn),
  12. conn: conn,
  13. }
  14. }
  15. func (w *debugWrapper) Close() error {
  16. return w.conn.Close()
  17. }