Documentation ¶
Overview ¶
Package errorsx contains error extensions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dialer ¶
type Dialer interface { // DialContext behaves like net.Dialer.DialContext. DialContext(ctx context.Context, network, address string) (net.Conn, error) }
Dialer establishes network connections.
type ErrorWrapperDialer ¶
type ErrorWrapperDialer struct { // Dialer is the underlying dialer. Dialer }
ErrorWrapperDialer is a dialer that performs error wrapping. The connection returned by the DialContext function will also perform error wrapping.
func (*ErrorWrapperDialer) DialContext ¶
func (d *ErrorWrapperDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)
DialContext implements Dialer.DialContext.
type ErrorWrapperQUICDialer ¶
type ErrorWrapperQUICDialer struct {
Dialer QUICContextDialer
}
ErrorWrapperQUICDialer is a dialer that performs quic err wrapping
func (*ErrorWrapperQUICDialer) DialContext ¶
func (d *ErrorWrapperQUICDialer) DialContext( ctx context.Context, network string, host string, tlsCfg *tls.Config, cfg *quic.Config) (quic.EarlySession, error)
DialContext implements ContextDialer.DialContext
type ErrorWrapperQUICListener ¶
type ErrorWrapperQUICListener struct { // QUICListener is the underlying listener. QUICListener QUICListener }
ErrorWrapperQUICListener is a QUICListener that wraps errors.
func (*ErrorWrapperQUICListener) Listen ¶
func (qls *ErrorWrapperQUICListener) Listen(addr *net.UDPAddr) (quicx.UDPLikeConn, error)
Listen implements QUICListener.Listen.
type ErrorWrapperResolver ¶
type ErrorWrapperResolver struct {
Resolver
}
ErrorWrapperResolver is a Resolver that knows about wrapping errors.
func (*ErrorWrapperResolver) Address ¶
func (r *ErrorWrapperResolver) Address() string
Address implements Resolver.Address.
func (*ErrorWrapperResolver) LookupHost ¶
LookupHost implements Resolver.LookupHost
func (*ErrorWrapperResolver) Network ¶
func (r *ErrorWrapperResolver) Network() string
Network implements Resolver.Network.
type ErrorWrapperTLSHandshaker ¶
type ErrorWrapperTLSHandshaker struct {
TLSHandshaker
}
ErrorWrapperTLSHandshaker wraps the returned error to be an OONI error
type QUICContextDialer ¶
type QUICContextDialer interface { // DialContext establishes a new QUIC session using the given // network and address. The tlsConfig and the quicConfig arguments // MUST NOT be nil. Returns either the session or an error. DialContext(ctx context.Context, network, address string, tlsConfig *tls.Config, quicConfig *quic.Config) (quic.EarlySession, error) }
QUICContextDialer is a dialer for QUIC using Context.
type QUICListener ¶
type QUICListener interface { // Listen creates a new listening UDPConn. Listen(addr *net.UDPAddr) (quicx.UDPLikeConn, error) }
QUICListener listens for QUIC connections.
type Resolver ¶
type Resolver interface { // LookupHost resolves a hostname to a list of IP addresses. LookupHost(ctx context.Context, hostname string) (addrs []string, err error) }
Resolver is a DNS resolver. The *net.Resolver used by Go implements this interface, but other implementations are possible.
type SafeErrWrapperBuilder ¶
type SafeErrWrapperBuilder struct { // Error is the error, if any Error error // Classifier is the local error to string classifier. When there is no // configured classifier we will use the generic classifier. Classifier func(err error) string // Operation is the operation that failed Operation string }
SafeErrWrapperBuilder contains a builder for ErrWrapper that is safe, i.e., behaves correctly when the error is nil.
func (SafeErrWrapperBuilder) MaybeBuild ¶
func (b SafeErrWrapperBuilder) MaybeBuild() (err error)
MaybeBuild builds a new ErrWrapper, if b.Error is not nil, and returns a nil error value, instead, if b.Error is nil.