Versions in this module Expand all Collapse all v0 v0.1.2 Aug 27, 2020 v0.1.0 Jun 30, 2020 Changes in this version + const BufSize + const DefaultAcceptBacklog + const DefaultEnableKeepAlive + const DefaultKeepAliveInterval + const DefaultReadTimeout + const DefaultRetryMax + const DefaultRetryWaitMax + const DefaultRetryWaitMin + const DefaultSessionCloseTimeout + const DefaultWriteTimeout + var ErrAddrEmpty = errors.New("wirenet: listener address is empty") + var ErrSessionClosed = errors.New("wirenet: session closed") + var ErrSessionNotFound = errors.New("wirenet: session not found") + var ErrStreamClosed = errors.New("wirenet: read/write on closed stream") + var ErrStreamHandlerNotFound = errors.New("wirenet: stream handler not found") + var ErrUnknownCertificateName = errors.New("wirenet: unknown certificate name") + var ErrWireClosed = errors.New("wirenet: wire closed") + func DefaultRetryPolicy(min, max time.Duration, attemptNum int) time.Duration + func LoadCertificates(name string, certPath string) (*tls.Config, error) + type ErrorHandler func(context.Context, error) + type Handler func(context.Context, Stream) + type Identification []byte + type OpError struct + Err error + Identification Identification + LocalAddr net.Addr + Op string + RemoteAddr net.Addr + SessionID uuid.UUID + func (e *OpError) Error() string + type Option func(*wire) + func WithConnectHook(hook func(io.Closer)) Option + func WithErrorHandler(h ErrorHandler) Option + func WithIdentification(id Identification, token Token) Option + func WithKeepAlive(flag bool) Option + func WithKeepAliveInterval(interval time.Duration) Option + func WithLogWriter(w io.Writer) Option + func WithReadWriteTimeouts(read, write time.Duration) Option + func WithRetryMax(n int) Option + func WithRetryPolicy(rp RetryPolicy) Option + func WithRetryWait(min, max time.Duration) Option + func WithSessionCloseHook(hook SessionHook) Option + func WithSessionCloseTimeout(dur time.Duration) Option + func WithSessionOpenHook(hook SessionHook) Option + func WithTLS(conf *tls.Config) Option + func WithTokenValidator(v TokenValidator) Option + type RetryPolicy func(min, max time.Duration, attemptNum int) time.Duration + type Session interface + Close func() error + CloseWire func() error + ID func() uuid.UUID + Identification func() Identification + IsClosed func() bool + OpenStream func(name string) (Stream, error) + StreamNames func() []string + type SessionHook func(Session) + type Sessions map[uuid.UUID]Session + type ShutdownError struct + Errors []error + func NewShutdownError() *ShutdownError + func (e *ShutdownError) Add(er error) + func (e *ShutdownError) Error() string + func (e *ShutdownError) IsFilled() bool + type Stream interface + ID func() uuid.UUID + IsClosed func() bool + Name func() string + Reader func() io.ReadCloser + Session func() Session + Writer func() io.WriteCloser + type Token []byte + type TokenValidator func(streamName string, id Identification, token Token) error + type Wire interface + Close func() error + Connect func() error + Session func(sessionID uuid.UUID) (Session, error) + Sessions func() Sessions + Stream func(name string, h Handler) + func Hub(addr string, opts ...Option) (Wire, error) + func Join(addr string, opts ...Option) (Wire, error) + func Mount(addr string, opts ...Option) (Wire, error)