Documentation ¶
Overview ¶
Error defines all errors that may happen when using the Sandwich Go library. It uses the error codes defined in the protobuf.
io describes the Sandwich I/O interface. The I/O interface is used by the implementation to perform all i/o operation.
Index ¶
- type ALPNError
- type APIError
- type ASN1Error
- type BaseError
- type CertificateError
- type ConfigurationError
- type DataSourceError
- type Error
- type HandshakeError
- type HandshakeStateError
- type IO
- type IOError
- type IORWWrapper
- type KEMError
- type PrivateKeyError
- type ProtobufError
- type RecordPlaneError
- type SocketError
- type SystemError
- type TLSConfigurationError
- type Tunnel
- type TunnelContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ALPNError ¶
type ALPNError struct {
BaseError
}
ALPNError defines an error that may occur when ALPN Protocol is provided.
type APIError ¶
type APIError struct {
BaseError
}
APIError defines the first-class API errors, such as Context errors, Socket errors and Tunnel errors.
type ASN1Error ¶
type ASN1Error struct {
BaseError
}
ASN1Error defines an error that may occur when a malformed ASN.1 document is provided.
type BaseError ¶
type BaseError struct {
// contains filtered or unexported fields
}
BaseError represents the base structure for all Sandwich errors.
type CertificateError ¶
type CertificateError struct {
BaseError
}
CertificateError defines an error that may occur when a configuration supplies a certificate that is malformed.
type ConfigurationError ¶
type ConfigurationError struct {
BaseError
}
ConfigurationError defines an error that may occur when a protobuf configuration is malformed.
type DataSourceError ¶
type DataSourceError struct {
BaseError
}
DataSourceError defines an error that may occur when a configuration provided a malformed DataSource.
type Error ¶
type Error interface { // Error extends the builtin `error` interface. error // `Code` returns the error code, defined in the protobuf. Code() int32 // `Unwrap` unwraps the next error. It is meant to be used with the `errors` // package. Unwrap() error // contains filtered or unexported methods }
Error represents the interface for all Sandwich errors.
type HandshakeError ¶
type HandshakeError struct {
BaseError
}
HandshakeError defines errors that can happen during the handshake stage. These errors are defined by the enum `HandshakeError` in `errors.proto`. They are used by `Tunnel.Handshake`.
type HandshakeStateError ¶
type HandshakeStateError struct {
BaseError
}
HandshakeStateError defines errors that take place during the handshake stage. These states are defined by the enum `HandshakeState` in `tunnel.proto`. They are used by `Tunnel.Handshake`.
type IO ¶
type IO interface { // Read reads data from the connection. Read(b []byte, tunnel_state pb.State) (n int, err *IOError) // Write writes data from the connection. Write(b []byte, tunnel_state pb.State) (n int, err *IOError) }
IO represents the I/O interface used by Sandwich.
type IOError ¶
type IOError struct {
BaseError
}
IOError defines the error that can happens during the i/o operations done by an I/O interface. These errors are defined by the enum `IOError` in `io.proto`.
func IOTCPClient ¶
Creates a Sandwich owned TCP based IO Object.
func NewIOError ¶
NewIOError creates an error from an error code. The error code is supposed to match a key in `ioErrorMap`, defined above. This function is publicly exposed, as it is meant to be used by the user to implement their own I/O interface.
func NewIOErrorFromEnum ¶
NewIOErrorFromEnum creates an error from the enum pb.IOError.
type IORWWrapper ¶
type IORWWrapper struct {
// contains filtered or unexported fields
}
--8<-- [start:go_io_rw] Wraps an io.ReadWriter object WARNING: errors are hard to map as they are just strings. So far, every error returns a generic IOError_IOERROR_UNKNOWN error code.
func IOWrapRW ¶
func IOWrapRW(conn io.ReadWriter) IORWWrapper
type KEMError ¶
type KEMError struct {
BaseError
}
KEMError defines an error that may occur when a KEM is invalid or unsupported.
type PrivateKeyError ¶
type PrivateKeyError struct {
BaseError
}
PrivateKeyError defines an error that may occur when a configuration supplies a private key that is malformed.
type ProtobufError ¶
type ProtobufError struct {
BaseError
}
ProtobufError defines an error that may occur when the protobuf message is malformed.
type RecordPlaneError ¶
type RecordPlaneError struct {
BaseError
}
RecordPlaneError defines the error that can happens during the record plane. These errors are defined by the enum `RecordError` in `tunnel.proto`. They are used by `Tunnel.Write` and `Tunnel.Read`.
type SocketError ¶
type SocketError struct {
BaseError
}
SocketError defines an error that may occur in the I/O socket interface.
type SystemError ¶
type SystemError struct {
BaseError
}
SystemError defines an error that may occur when a system error is encountered, such as a memory allocation failure.
type TLSConfigurationError ¶
type TLSConfigurationError struct {
BaseError
}
TLSConfigurationError defines an error that may occur when a protobuf configuration using the TLS protocol is malformed.
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
Tunnel wraps a `struct SandwichTunnel *` and exposes its methods.
func NewTunnel ¶
func NewTunnel(ctx *TunnelContext, io IO, configuration *api.TunnelConfiguration) (*Tunnel, error)
NewTunnel creates a Sandwich tunnel from a context, an io and a configuration.
func (*Tunnel) Handshake ¶
Handshakes performs or resumes the handshake stage. If nil is returned, it means the handshake is done.
func (*Tunnel) IO ¶
IO returns the IO interface used by a tunnel. The interface is borrowed to the user. Its ownership remains to the Tunnel.
type TunnelContext ¶
type TunnelContext struct {
// contains filtered or unexported fields
}
TunnelContext wraps a `struct Context *` and exposes few methods for convenience.
func NewTunnelContext ¶
func NewTunnelContext(configuration *api.Configuration) (*TunnelContext, error)
NewTunnelContext fills a Sandwich context from a protobuf configuration.