github.com/slackhq/nebula@v1.9.0/sshd/writer.go (about)

     1  package sshd
     2  
     3  import "io"
     4  
     5  type StringWriter interface {
     6  	WriteLine(string) error
     7  	Write(string) error
     8  	WriteBytes([]byte) error
     9  	GetWriter() io.Writer
    10  }
    11  
    12  type stringWriter struct {
    13  	w io.Writer
    14  }
    15  
    16  func (w *stringWriter) WriteLine(s string) error {
    17  	return w.Write(s + "\n")
    18  }
    19  
    20  func (w *stringWriter) Write(s string) error {
    21  	_, err := w.w.Write([]byte(s))
    22  	return err
    23  }
    24  
    25  func (w *stringWriter) WriteBytes(b []byte) error {
    26  	_, err := w.w.Write(b)
    27  	return err
    28  }
    29  
    30  func (w *stringWriter) GetWriter() io.Writer {
    31  	return w.w
    32  }