conn

package
v0.0.35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultSalt = "crypto"
)

Functions

func WithEncryption

func WithEncryption(rwc io.ReadWriteCloser, key []byte) (io.ReadWriteCloser, error)

func WrapReadWriteCloser

func WrapReadWriteCloser(r io.Reader, w io.Writer, closeFn func() error) io.ReadWriteCloser

closeFn will be called only once

Types

type ReadWriteCloser

type ReadWriteCloser struct {
	// contains filtered or unexported fields
}

func (*ReadWriteCloser) Close

func (rwc *ReadWriteCloser) Close() (errRet error)

func (*ReadWriteCloser) Read

func (rwc *ReadWriteCloser) Read(p []byte) (n int, err error)

func (*ReadWriteCloser) Write

func (rwc *ReadWriteCloser) Write(p []byte) (n int, err error)

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader is an io.Reader that can read encrypted bytes. Now it only supports aes-128-cfb.

func NewReader

func NewReader(r io.Reader, key []byte) *Reader

NewReader returns a new Reader that decrypts bytes from r

func (*Reader) Read

func (r *Reader) Read(p []byte) (nRet int, errRet error)

Read satisfies the io.Reader interface.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer is an io.Writer that can write encrypted bytes. Now it only support aes-128-cfb.

func NewWriter

func NewWriter(w io.Writer, key []byte) (*Writer, error)

NewWriter returns a new Writer that encrypts bytes to w.

func (*Writer) Write

func (w *Writer) Write(p []byte) (nRet int, errRet error)

Write satisfies the io.Writer interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL