transport

package
v0.4.0-3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Logger        logrus.FieldLogger
	TCPClientOpts tcp.ClientOptions
	TCPServerOpts tcp.ServerOptions
}

func DefaultOptions

func DefaultOptions() Options

func (Options) WithLogger

func (opts Options) WithLogger(logger logrus.FieldLogger) Options

func (Options) WithTCPClientOptions

func (opts Options) WithTCPClientOptions(clientOpts tcp.ClientOptions) Options

func (Options) WithTCPServerOptions

func (opts Options) WithTCPServerOptions(serverOpts tcp.ServerOptions) Options

type TCPOptions

type TCPOptions struct {
}

type Transport

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

func New

func New(opts Options, handshaker handshake.Handshaker) *Transport

func (*Transport) DidReceivePing

func (trans *Transport) DidReceivePing(version uint8, data []byte, from id.Signatory) (wire.Message, error)

func (*Transport) DidReceivePingAck

func (trans *Transport) DidReceivePingAck(version uint8, data []byte, from id.Signatory) error

func (*Transport) DidReceivePull

func (trans *Transport) DidReceivePull(version uint8, data []byte, from id.Signatory) (wire.Message, error)

func (*Transport) DidReceivePullAck

func (trans *Transport) DidReceivePullAck(version uint8, data []byte, from id.Signatory) error

func (*Transport) DidReceivePush

func (trans *Transport) DidReceivePush(version uint8, data []byte, from id.Signatory) (wire.Message, error)

func (*Transport) DidReceivePushAck

func (trans *Transport) DidReceivePushAck(version uint8, data []byte, from id.Signatory) error

func (*Transport) Run

func (trans *Transport) Run(ctx context.Context)

Run the Transport until the context is done. This method must only be called after the SetPingListener, SetPushListener, and SetPullListener methods have been called (if necessary). Otherwise, this method will panic.

func (*Transport) Send

func (trans *Transport) Send(ctx context.Context, addr wire.Address, msg wire.Message) error

Send a message to an address. The Transport will select the appropriate client implementation based on the protocol in the target address. If the protocol is not supported, an error is returned. Otherwise, any error from the selected client is returned.

func (*Transport) SetPingListener

func (trans *Transport) SetPingListener(listener wire.PingListener)

SetPingListener must be called before calling the Run method. Otherwise, this method will panic.

func (*Transport) SetPullListener

func (trans *Transport) SetPullListener(listener wire.PullListener)

SetPullListener must be called before calling the Run method. Otherwise, this method will panic.

func (*Transport) SetPushListener

func (trans *Transport) SetPushListener(listener wire.PushListener)

SetPushListener must be called before calling the Run method. Otherwise, this method will panic.

type WSOptions

type WSOptions struct {
	tcp.ClientOptions
	tcp.ServerOptions
}

Jump to

Keyboard shortcuts

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