TCP transport implementation
Types
TcpTransport = ref object of Transport servers*: seq[StreamServer]
- Source Edit
TcpTransportError = object of transport.TransportError
- Source Edit
Consts
TcpTransportTrackerName = "libp2p.tcptransport"
- Source Edit
Procs
proc connHandler(self: TcpTransport; client: StreamTransport; observedAddr: Opt[MultiAddress]; localAddr: Opt[MultiAddress]; dir: Direction): RawConn {....raises: [], tags: [TimeEffect, RootEffect], forbids: [].}
- Source Edit
proc new(T: typedesc[TcpTransport]; flags: set[ServerFlags] = {}; upgrade: Upgrade; connectionsTimeout = 10.minutes): T:type {....raises: [].}
- Source Edit
Methods
method accept(self: TcpTransport): InternalRaisesFuture[RawConn, (TransportError, CancelledError)] {....stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
-
accept a new TCP connection, returning nil on non-fatal errors
Raises an exception when the transport is broken and cannot be used for accepting further connections
Source Edit method dial(self: TcpTransport; hostname: string; address: MultiAddress; peerId: Opt[PeerId] = Opt.none(PeerId)): InternalRaisesFuture[ RawConn, (TransportError, CancelledError)] {....stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
- dial a peer Source Edit
method handles(t: TcpTransport; address: MultiAddress): bool {....raises: [], raises: [], tags: [], forbids: [].}
- Source Edit
method start(self: TcpTransport; addrs: seq[MultiAddress]): InternalRaisesFuture[ void, (LPError, TransportError, CancelledError)] {....stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
- Start transport listening to the given addresses - for dial-only transports, start with an empty list Source Edit
method stop(self: TcpTransport): InternalRaisesFuture[void, void] {. ...stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
Exports
-
TransportInvalidAddrError, TransportStartError, dial, Transport, newTransportClosedError, TransportDialError, upgrade, safeCloseWait, toTransportAddress, stop, accept, TransportError, TransportClosedError, NetworkReachability, initialize, dial, safeClose, handles, start, DNS_OR_IP, shortLog, init, random, UDP_DNS, $, MaError, libp2p_network_bytes, writeField, ephemeral, replaceIp, MaPatternOp, ==, WS_DNS, initVBuffer, <=, MaxSizeError, decode, ==, shortLog, filterIt, ECDHEScheme, shortLog, hash, supportsPacked, writeField, init, closed, [], shuffle, random, init, Secret, peekVarint, payload, $, validate, mapOr, chroniclesFormatItIMPL, init, Memory, bytes, publicRoutableAddressPolicy, getPubKey, maxInlineKeyLength, TranscoderDNS, QUIC, writeField, [], init, ephemeral, withValue, PeerInfoObserver, getIp, generateBytes, WS_IP, write, MAKind, decode, getBytes, write, decode, init, noPrivateAddressPolicy, getRepeatedField, generate, matchPartial, getBytes, len, areAddrsConsistent, init, readLp, HTTP, initVBuffer, atEof, LPStreamTrackerName, removeObserver, peekSeq, update, TCP_IP4, toOpt, join, fullAddrs, payloadType, LPStreamError, init, IP, protoAddress, QUIC_V1_IP, newRng, ==, shortLog, withValue, checkValid, getPublicKey, chroniclesFormatItIMPL, libp2p_multiaddress_exts, WebSockets, readFieldInto, getPart, CircuitRelay, extractPublicKey, mapAnd, new, maErr, computeFieldSize, UDP_IP, newLPStreamEOFError, init, random, ==, DNSADDR, AddressMapper, write, notifyObservers, WSS, QUIC_V1, TCP_IP, close, init, closeImpl, toCidString, readSeq, toBytes, TCP_DNS, closeWrite, shortLog, wasResetLocally, encode, UDP_IP4, len, capLen, init, protoName, protoArgument, toRawBytes, supportsPacked, $, writeField, TCP_IP6, init, DNS, WSS_DNS, match, writeLPVarint, CryptoResult, LPStream, parseFullAddress, WebRTCDirect, PeerAddressPolicy, init, $, UDP, PeerInfo, TranscoderOnion, StreamTracker, defaultAddressPolicy, init, LPStreamResetError, writeArray, LPStreamIncompleteError, PeerId, >, [], LPStreamEOFError, IP6, shortLog, reset, initVBuffer, PKScheme, random, stretchKeys, accepts, addObserver, Connection, write, init, generate, TCP, PrivateKey, readFieldInto, write, init, RawConn, &=, PeerInfoError, newBearSslRng, verify, newLPStreamClosedError, random, TranscoderMemory, toString, TranscoderIP4, init, toException, init, goffset, getRawBytes, pick, KeyPair, init, high, cmp, init, DefaultConnectionTimeout, Signature, chroniclesFormatItIMPL, contains, hash, exclIfIt, computeFieldSize, computeFieldSize, supportsPacked, stripPeerId, toBytes, DigestSheme, IPFS, getField, shortLog, readOnce, init, resetImpl, isEmpty, shortLog, data, chroniclesFormatItIMPL, hex, protocols, chroniclesFormatItIMPL, computeFieldSize, HTTPS, UNIX, LPError, supportsPacked, readFieldInto, TLS_WS, sign, encode, Rng, getProtocolArgument, supported, MaResult, init, supportsPacked, toBytes, QUIC_V1_IP4, writeSeq, finish, &, DNS6, expandAddrs, writeField, decode, IpTransportProtocol, key, IP4, TranscoderPort, getBytes, readFieldInto, DNSANY, >=, QUIC_V1_DNS, payloadDomain, $, MaPattern, withValue, MuxedStream, init, LPStreamLimitError, TranscoderOnion3, SignedPayload, mac, toBytes, protoArgument, newLPStreamLimitError, keyOpenArray, match, WebSockets_DNS, SignedPeerRecord, $, isEmpty, writeLp, toCid, init, newLPStreamIncompleteError, MAProtocol, newLPStreamResetError, initStream, init, getField, DNS4, readFieldInto, getWrapped, selectBest, supportsPacked, P2PPattern, Envelope, hasPublicKey, toException, init, Stream, isEnough, Reliable, addrs, hex, closeImpl, getBytes, ivOpenArray, WS, init, encode, take, init, init, match, readArray, filterAddrs, <, iv, readLine, Eof, CryptoError, computeFieldSize, append, hash, init, parseFullAddress, WSS_IP, LPStreamConnDownError, peekArray, PeerRecord, SupportedSchemes, generate, QUIC_DNS, Unreliable, SupportedSchemesInt, random, checkFutures, supportsPacked, macOpenArray, init, checkAddresses, validate, protoCode, mapEq, libp2p_pki_schemes, Onion3, TcpOnion3, toFullAddress, pickOne, concat, TranscoderP2P, AddressInfo, ConnectionTrackerName, TranscoderIP6, new, write, EnvelopeError, computeFieldSize, encode, len, newLPStreamRemoteClosedError, TranscoderIP6Zone, MaPatResult, Direction, init, InvalidVarintError, shortLog, items, init, write, write, init, UTP, readVarint, verify, readFieldInto, TimeoutHandler, QUIC_IP, init, PublicKey, WebSockets_IP, VBuffer, writeLp, writePBVarint, toChunks, readExactly, newLPStreamConnDownError, init, initStream, MultiAddress, supportsPacked, readVarint, toOpt, closeWithEOF, RsaDefaultKeySize, orError, LPStreamRemoteClosedError, <, MaInvalidAddress, generate, LPStreamClosedError, writeField, write, getOrder, TranscoderUnix, toOpt, writeVarint, DNS_OR_IP, LPStreamError, AlreadyExpectingConnectionError, shortLog, init, random, new, UDP_DNS, MaError, libp2p_network_bytes, writeField, ephemeral, decode, replaceIp, unprotect, MaPatternOp, bumpDecayingTag, WS_DNS, initVBuffer, <=, decode, MaxSizeError, removeDecayingTag, LPError, handler, filterIt, protect, ECDHEScheme, shortLog, <, supportsPacked, writeField, closed, LPStream, addConnEventHandler, WatermarkPolicy, [], new, shuffle, random, key, VBuffer, Secret, peekVarint, random, handshake, maxConnections, validate, mapOr, guessDialableAddr, chroniclesFormatItIMPL, computeFieldSize, init, secure, Memory, UpgradeFailedError, publicRoutableAddressPolicy, getPubKey, IdentityInvalidMsgError, maxInlineKeyLength, addHandler, TranscoderDNS, QUIC, ProtoVersion, writeField, [], init, ephemeral, withValue, mac, init, PeerInfoObserver, getIp, removeConnEventHandler, libp2p_pki_schemes, WS_IP, isEnough, MAKind, write, take, init, noPrivateAddressPolicy, codec, getRepeatedField, generate, matchPartial, addObservation, releaseOutgoing, removePeerEventHandler, push, getBytes, peerScore, areAddrsConsistent, trackConnection, ==, init, readFieldInto, readLp, HTTP, initVBuffer, start, Delta, atEof, PeerEventKind, getOutgoingSlot, supportsPacked, peekSeq, TCP_IP4, toOpt, join, fullAddrs, payloadType, decode, $, IP, protoAddress, QUIC_V1_IP, newRng, ==, shortLog, withValue, SecureConn, checkValid, handle, getPublicKey, chroniclesFormatItIMPL, libp2p_multiaddress_exts, len, readFieldInto, getPart, libp2p_failed_upgrades_incoming, releaseIncoming, CircuitRelay, extractPublicKey, mapAnd, maErr, UDP_IP, new, newLPStreamEOFError, selectMuxer, DNSANY, connCount, random, readMessage, DNSADDR, handler, AddressMapper, IdentifyPushHandler, IdentifyPushCodec, write, new, PeerId, notifyObservers, WSS, QUIC_V1, TCP_IP, selectMuxer, computeFieldSize, PeerScoring, init, closeImpl, toCidString, readSeq, toBytes, TCP_DNS, closeWrite, shortLog, wasResetLocally, encode, UDP_IP4, WebSockets, capLen, untagPeer, protoName, PeerEventHandler, LPProtoHandler, secure, ==, toRawBytes, supportsPacked, IdentifyPush, getStream, $, writeField, TCP_IP6, resetImpl, DNS, WSS_DNS, list, match, <, CryptoResult, WebSockets_DNS, init, WebRTCDirect, PeerAddressPolicy, init, upgrade, $, UDP, TranscoderOnion, StreamTracker, waitForPeerReady, write, init, LPStreamResetError, Rng, writeArray, ConnManager, decode, LPStreamIncompleteError, >, LPStreamEOFError, IP6, shortLog, new, release, writeField, initVBuffer, DecayFn, PKScheme, readVarint, new, toString, random, triggerConnEvent, triggerPeerEvents, stretchKeys, accepts, addObserver, Connection, init, generate, TCP, PrivateKey, dropPeer, readFieldInto, write, close, &=, PeerInfoError, canOpenOutgoing, newBearSslRng, QUIC_DNS, maxInOut, newLPStreamClosedError, payload, chroniclesExpandItIMPL, TranscoderMemory, close, trackMuxer, init, $, toException, init, Matcher, Upgrade, goffset, HandlerHolder, getRawBytes, pick, SecureConnTrackerName, KeyPair, init, high, libp2p_failed_upgrades_outgoing, cmp, init, peekArray, initStream, Signature, chroniclesFormatItIMPL, contains, computeFieldSize, tagPeerDecaying, computeFieldSize, removeObserver, supportsPacked, stripPeerId, getStream, DigestSheme, init, IPFS, shortLog, readOnce, init, Secure, resetImpl, isEmpty, toCid, ConnEventKind, MultiAddress, chroniclesFormatItIMPL, contains, hex, protocols, codec=, bytes, selectBest, hash, HTTPS, UNIX, exclIfIt, encode, computeFieldSize, TooManyConnectionsError, supportsPacked, TLS_WS, TranscoderIP6, init, addHandler, storeMuxer, TranscoderIP4, getProtocolArgument, PeerEvent, data, supported, MaResult, init, supportsPacked, getStream, QUIC_V1_IP4, writeSeq, ConnEvent, init, &, $, DNS6, expandAddrs, items, [], IpTransportProtocol, init, IP4, TranscoderPort, getBytes, addPeerEventHandler, init, >=, expectConnection, QUIC_V1_DNS, finish, payloadDomain, $, shortLog, withValue, handle, MuxedStream, canAcceptIncoming, readFieldInto, init, LPStreamLimitError, TranscoderOnion3, ConnectionLimits, SignedPayload, closeImpl, toBytes, protoArgument, decayFixed, newLPStreamLimitError, getBytes, MaPattern, keyOpenArray, len, tagPeer, match, parseFullAddress, toOpt, closeImpl, isEmpty, writeLp, decode, connectedPeers, reset, new, newLPStreamIncompleteError, chroniclesExpandItIMPL, generateBytes, MAProtocol, newLPStreamResetError, reserveOutgoing, initStream, contains, init, shortLog, DNS4, maxTotal, readFieldInto, getWrapped, chroniclesFormatItIMPL, encode, readFieldInto, P2PPattern, getWrapped, Envelope, hasPublicKey, toException, init, Stream, getBytes, init, getConnections, Reliable, addrs, hex, write, toOpt, WS, AgentVersion, MultiStreamError, init, MultistreamSelect, encode, LPProtocol, init, init, init, match, readArray, filterAddrs, writeLPVarint, iv, RawConn, reserveIncoming, readLine, Eof, CryptoError, chroniclesFormatItIMPL, verify, append, init, parseFullAddress, WSS_IP, LPStreamConnDownError, DefaultConnectionTimeout, PeerRecord, init, SupportedSchemes, getField, select, generate, RsaDefaultKeySize, computeFieldSize, Unreliable, SupportedSchemesInt, random, checkFutures, isProtected, handler=, ConnectionSlot, verify, supportsPacked, macOpenArray, init, checkAddresses, validate, $, mapEq, init, Onion3, write, LPStreamTrackerName, toFullAddress, select, pickOne, concat, TranscoderP2P, PeerInfo, AddressInfo, decayNone, ConnectionTrackerName, sign, new, init, write, EnvelopeError, IdentifyInfo, IdentifyError, Identify, encode, len, newLPStreamRemoteClosedError, TranscoderIP6Zone, MaPatResult, Direction, readOnce, init, InvalidVarintError, shortLog, writeField, ==, init, IdentifyNoPubKeyError, write, write, identify, init, UTP, toBytes, readVarint, hash, TimeoutHandler, getMostObservedProtosAndPorts, init, ObservedAddrManager, PublicKey, ConnEventHandler, lookupProtocol, WebSockets_IP, writeLp, decayLinear, update, start, IdentityNoMatchError, writePBVarint, toChunks, readExactly, protoArgument, QUIC_IP, newLPStreamConnDownError, new, init, IdentifyCodec, shortLog, initStream, supportsPacked, ivOpenArray, closeWithEOF, TcpOnion3, orError, getField, LPStreamRemoteClosedError, availableSlots, hash, protoCode, stop, MaInvalidAddress, select, generate, LPStreamClosedError, getIncomingSlot, defaultAddressPolicy, toBytes, getOrder, TranscoderUnix, SignedPeerRecord, stop, writeVarint