Documentation ¶
Index ¶
- Variables
- func BufferedPipe() (*BufferedMemoryReadWriter, *BufferedMemoryReadWriter)
- type BufferedMemoryReadWriter
- type SecureReadWriter
- func NewSecureReadWriterWithPrivateAndPublicKey(rw io.ReadWriter, privateKey ed25519.PrivateKey, publicKey ed25519.PublicKey) *SecureReadWriter
- func NewSecureReadWriterWithPrivateKey(rw io.ReadWriter, privateKey ed25519.PrivateKey) *SecureReadWriter
- func NewSecureReadWriterWithPublicKey(rw io.ReadWriter, publicKey ed25519.PublicKey) *SecureReadWriter
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidHandshake = errors.New("the remote end of the tunnel provided invalid handshake data")
ErrInvalidHandshake is returned when the initial cryptographic handshake fails due to some invalid data provided by the remote end of the tunnel. This usually indicates the remote end of the tunnel is misconfigured.
var ErrNonceExhaustion = errors.New("the set of nonces for this symmetric key has been exhausted")
ErrNonceExhaustion is returned when the symmetric key used for the tunnel has been used extensively with a given nonce prefix. The tunnel should be re-established.
var ErrVerificationFailed = errors.New("verification from the remote end of the tunnel was provided but invalid")
ErrVerificationFailed is returned when the remote end of the tunnel provided verification that was invalid.
var ErrVerificationOmitted = errors.New("verification from the remote end of the tunnel was expected but not provided")
ErrVerificationOmitted is returned when the remote end of the tunnel was expected to provide verification, but did not.
Functions ¶
func BufferedPipe ¶
func BufferedPipe() (*BufferedMemoryReadWriter, *BufferedMemoryReadWriter)
Types ¶
type BufferedMemoryReadWriter ¶
type BufferedMemoryReadWriter struct {
// contains filtered or unexported fields
}
type SecureReadWriter ¶
type SecureReadWriter struct {
// contains filtered or unexported fields
}
SecureReadWriter is an io.ReadWriter that wraps an underlying io.ReadWriter in a secure tunnel using modern elliptic-curve cryptography.
While this implementation is safe for concurrent use, it is recommended only a single goroutine read at a time to avoid lock contention.
func NewSecureReadWriterWithPrivateAndPublicKey ¶
func NewSecureReadWriterWithPrivateAndPublicKey(rw io.ReadWriter, privateKey ed25519.PrivateKey, publicKey ed25519.PublicKey) *SecureReadWriter
Creates a new SecureReadWriter that will provide verification and also verify the remote end of the tunnel.
func NewSecureReadWriterWithPrivateKey ¶
func NewSecureReadWriterWithPrivateKey(rw io.ReadWriter, privateKey ed25519.PrivateKey) *SecureReadWriter
Creates a new SecureReadWriter that will provide verification but not verify the remote end of the tunnel.
func NewSecureReadWriterWithPublicKey ¶
func NewSecureReadWriterWithPublicKey(rw io.ReadWriter, publicKey ed25519.PublicKey) *SecureReadWriter
Creates a new SecureReadWriter that will verify the remote end of the tunnel but not provide any verification itself.
func (*SecureReadWriter) Read ¶
func (srw *SecureReadWriter) Read(p []byte) (int, error)
Reads data from the underlying io.ReadWriter. This method will perform the necessary cryptographic handshake with the remote end of the tunnel, if required, before reading any data.
It is common for Read to fill p with less bytes than its length.
func (*SecureReadWriter) Write ¶
func (srw *SecureReadWriter) Write(p []byte) (int, error)
Writes data to the underlying io.ReadWriter. This method will perform the necessary cryptographic handshake with the remote end of the tunnel, if required, before writing any data.