Documentation ¶
Index ¶
- Variables
- type Options
- func (opts Options) WithClientTimeout(timeout time.Duration) Options
- func (opts Options) WithExpiry(minimumDuration time.Duration) Options
- func (opts Options) WithHost(host string) Options
- func (opts Options) WithLogger(logger *zap.Logger) Options
- func (opts Options) WithOncePoolOptions(oncePoolOpts handshake.OncePoolOptions) Options
- func (opts Options) WithPort(port uint16) Options
- func (opts Options) WithServerTimeout(timeout time.Duration) Options
- type Transport
- func (t *Transport) Host() string
- func (t *Transport) IsConnected(remote id.Signatory) bool
- func (t *Transport) IsLinked(remote id.Signatory) bool
- func (t *Transport) Link(remote id.Signatory)
- func (t *Transport) Port() uint16
- func (t *Transport) Receive(ctx context.Context, receiver func(id.Signatory, wire.Packet) error)
- func (t *Transport) Run(ctx context.Context)
- func (t *Transport) Self() id.Signatory
- func (t *Transport) Send(ctx context.Context, remote id.Signatory, msg wire.Msg) error
- func (t *Transport) Table() dht.Table
- func (t *Transport) Unlink(remote id.Signatory)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultHost = "localhost" DefaultPort = uint16(3333) DefaultEncoder = codec.PlainEncoder DefaultDecoder = codec.PlainDecoder DefaultDialTimeout = policy.ConstantTimeout(time.Second) DefaultClientTimeout = 10 * time.Second DefaultServerTimeout = 10 * time.Second DefaultExpiryTimeout = time.Minute )
Default options.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { Logger *zap.Logger Host string Port uint16 Encoder codec.Encoder Decoder codec.Decoder DialTimeout policy.Timeout ClientTimeout time.Duration ServerTimeout time.Duration OncePoolOptions handshake.OncePoolOptions ExpiryDuration time.Duration }
Options used to parameterise the behaviour of a Transport.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions returns Options with sensible defaults.
func (Options) WithClientTimeout ¶
func (Options) WithOncePoolOptions ¶
func (opts Options) WithOncePoolOptions(oncePoolOpts handshake.OncePoolOptions) Options
Click to show internal directories.
Click to hide internal directories.