libp2p/protocols/protocol

Search:
Group by:
Source   Edit  

Types

LPProtocol = ref object of RootObj
  started*: bool
  codecs*: seq[string]
Source   Edit  
LPProtoHandler = proc (stream: Stream; proto: string): Future[void] {.
    async: (...raises: [CancelledError]).}
Source   Edit  

Procs

func canAcceptIncoming(p: LPProtocol; peerId: PeerId): bool {....raises: [],
    tags: [], forbids: [].}
Returns true if an incoming stream from peerId is within all configured inbound budgets. Returns false when any limit would be exceeded. Source   Edit  
func canOpenOutgoing(p: LPProtocol; peerId: PeerId): bool {....raises: [],
    tags: [], forbids: [].}
Returns true if an outgoing stream to peerId is within all configured outbound budgets. Returns false when any limit would be exceeded. Source   Edit  
func codec(p: LPProtocol): string {....raises: [], tags: [], forbids: [].}
Source   Edit  
func codec=(p: LPProtocol; codec: string) {....raises: [], tags: [], forbids: [].}
Source   Edit  
func handler=(p: LPProtocol; handler: LPProtoHandler) {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
proc new(T: type LPProtocol; codecs: seq[string]; handler: LPProtoHandler;
         maxIncomingStreamsTotal: Opt[int] | int = Opt.none(int);
         maxIncomingStreamsPerPeer: Opt[int] | int = Opt.none(int);
         maxOutgoingStreamsTotal: Opt[int] | int = Opt.none(int);
         maxOutgoingStreamsPerPeer: Opt[int] | int = Opt.none(int)): T:type {.
    ...raises: [].}
Source   Edit  
proc releaseIncoming(p: LPProtocol; peerId: PeerId) {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
proc releaseOutgoing(p: LPProtocol; peerId: PeerId) {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
proc reserveIncoming(p: LPProtocol; peerId: PeerId): bool {....raises: [],
    tags: [], forbids: [].}
Source   Edit  
proc reserveOutgoing(p: LPProtocol; peerId: PeerId): bool {....raises: [],
    tags: [], forbids: [].}
Source   Edit  

Methods

method init(p: LPProtocol) {.base, ...gcsafe, raises: [], tags: [], forbids: [].}
Source   Edit  
method start(p: LPProtocol): InternalRaisesFuture[void, (CancelledError,)] {.
    base, ...stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect],
    forbids: [].}
Source   Edit  
method stop(p: LPProtocol): InternalRaisesFuture[void, void] {.base,
    ...stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect],
    forbids: [].}
Source   Edit  

Templates

template handler(p: LPProtocol): LPProtoHandler {..}
Source   Edit  
template handler(p: LPProtocol; stream: Stream; proto: string): Future[void] {..}
Source   Edit