Documentation ¶
Index ¶
- type Listener
- type Listeners
- type P2P
- func (p2p *P2P) CheckProtoExists(proto string) bool
- func (p2p *P2P) ForwardLocal(ctx context.Context, peer peer.ID, proto protocol.ID, bindAddr ma.Multiaddr) (Listener, error)
- func (p2p *P2P) ForwardRemote(ctx context.Context, proto protocol.ID, addr ma.Multiaddr, reportRemote bool) (Listener, error)
- type Stream
- type StreamRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Listener ¶
type Listener interface { Protocol() protocol.ID ListenAddress() ma.Multiaddr TargetAddress() ma.Multiaddr // contains filtered or unexported methods }
Listener listens for connections and proxies them to a target
type Listeners ¶ added in v0.4.18
Listeners manages a group of Listener implementations, checking for conflicts and optionally dispatching connections
type P2P ¶
type P2P struct { ListenersLocal *Listeners ListenersP2P *Listeners Streams *StreamRegistry // contains filtered or unexported fields }
P2P structure holds information on currently running streams/Listeners
func (*P2P) CheckProtoExists ¶
CheckProtoExists checks whether a proto handler is registered to mux handler
type Stream ¶ added in v0.4.18
type Stream struct { Protocol protocol.ID OriginAddr ma.Multiaddr TargetAddr ma.Multiaddr Local manet.Conn Remote net.Stream Registry *StreamRegistry // contains filtered or unexported fields }
Stream holds information on active incoming and outgoing p2p streams.
type StreamRegistry ¶
type StreamRegistry struct { sync.Mutex Streams map[uint64]*Stream ifconnmgr.ConnManager // contains filtered or unexported fields }
StreamRegistry is a collection of active incoming and outgoing proto app streams.
func (*StreamRegistry) Close ¶ added in v0.4.18
func (r *StreamRegistry) Close(s *Stream) error
Close stream endpoints and deregister it
func (*StreamRegistry) Deregister ¶
func (r *StreamRegistry) Deregister(streamID uint64)
Deregister deregisters stream from the registry
func (*StreamRegistry) Register ¶
func (r *StreamRegistry) Register(streamInfo *Stream)
Register registers a stream to the registry
func (*StreamRegistry) Reset ¶ added in v0.4.18
func (r *StreamRegistry) Reset(s *Stream) error
Reset closes stream endpoints and deregisters it