This module implements wire network connection procedures.
Consts
RTRANSPMA = (operator: Or, args: [(operator: Or, args: [(operator: And, args: [( operator: Or, args: [(operator: Eq, args: [], value: 53), (operator: Eq, args: [], value: 54), (operator: Eq, args: [], value: 55), (operator: Eq, args: [], value: 56)], value: 0), (operator: Eq, args: [], value: 6)], value: 0), (operator: And, args: [( operator: Or, args: [(operator: Eq, args: [], value: 4), (operator: Eq, args: [], value: 41)], value: 0), (operator: Eq, args: [], value: 6)], value: 0)], value: 0), (operator: Or, args: [( operator: And, args: [(operator: Or, args: [(operator: And, args: [( operator: Or, args: [(operator: Eq, args: [], value: 53), (operator: Eq, args: [], value: 54), (operator: Eq, args: [], value: 55), (operator: Eq, args: [], value: 56)], value: 0), (operator: Eq, args: [], value: 6)], value: 0), (operator: And, args: [( operator: Or, args: [(operator: Eq, args: [], value: 4), (operator: Eq, args: [], value: 41)], value: 0), (operator: Eq, args: [], value: 6)], value: 0)], value: 0), (operator: Eq, args: [], value: 477)], value: 0), ( operator: And, args: [(operator: Or, args: [(operator: And, args: [( operator: Or, args: [(operator: Eq, args: [], value: 53), (operator: Eq, args: [], value: 54), (operator: Eq, args: [], value: 55), (operator: Eq, args: [], value: 56)], value: 0), (operator: Eq, args: [], value: 6)], value: 0), (operator: And, args: [( operator: Or, args: [(operator: Eq, args: [], value: 4), (operator: Eq, args: [], value: 41)], value: 0), (operator: Eq, args: [], value: 6)], value: 0)], value: 0), (operator: Or, args: [ (operator: Eq, args: [], value: 478), (operator: And, args: [ (operator: Eq, args: [], value: 448), (operator: Eq, args: [], value: 477)], value: 0)], value: 0)], value: 0)], value: 0), (operator: Eq, args: [], value: 400)], value: 0)
- Source Edit
TRANSPMA = (operator: Or, args: [(operator: Or, args: [(operator: Or, args: [( operator: And, args: [(operator: Or, args: [ (operator: Eq, args: [], value: 53), (operator: Eq, args: [], value: 54), (operator: Eq, args: [], value: 55), (operator: Eq, args: [], value: 56)], value: 0), (operator: Eq, args: [], value: 6)], value: 0), (operator: And, args: [(operator: Or, args: [ (operator: Eq, args: [], value: 4), (operator: Eq, args: [], value: 41)], value: 0), (operator: Eq, args: [], value: 6)], value: 0)], value: 0), (operator: Or, args: [(operator: And, args: [( operator: Or, args: [(operator: And, args: [(operator: Or, args: [ (operator: Eq, args: [], value: 53), (operator: Eq, args: [], value: 54), (operator: Eq, args: [], value: 55), (operator: Eq, args: [], value: 56)], value: 0), (operator: Eq, args: [], value: 6)], value: 0), (operator: And, args: [( operator: Or, args: [(operator: Eq, args: [], value: 4), (operator: Eq, args: [], value: 41)], value: 0), (operator: Eq, args: [], value: 6)], value: 0)], value: 0), (operator: Eq, args: [], value: 477)], value: 0), (operator: And, args: [( operator: Or, args: [(operator: And, args: [(operator: Or, args: [ (operator: Eq, args: [], value: 53), (operator: Eq, args: [], value: 54), (operator: Eq, args: [], value: 55), (operator: Eq, args: [], value: 56)], value: 0), (operator: Eq, args: [], value: 6)], value: 0), (operator: And, args: [( operator: Or, args: [(operator: Eq, args: [], value: 4), (operator: Eq, args: [], value: 41)], value: 0), (operator: Eq, args: [], value: 6)], value: 0)], value: 0), (operator: Or, args: [ (operator: Eq, args: [], value: 478), (operator: And, args: [ (operator: Eq, args: [], value: 448), (operator: Eq, args: [], value: 477)], value: 0)], value: 0)], value: 0)], value: 0), (operator: Eq, args: [], value: 400)], value: 0), (operator: Or, args: [( operator: And, args: [(operator: And, args: [(operator: Or, args: [ (operator: Eq, args: [], value: 53), (operator: Eq, args: [], value: 54), (operator: Eq, args: [], value: 55), (operator: Eq, args: [], value: 56)], value: 0), (operator: Eq, args: [], value: 273)], value: 0), (operator: Eq, args: [], value: 460)], value: 0), ( operator: And, args: [(operator: And, args: [(operator: Or, args: [ (operator: Eq, args: [], value: 4), (operator: Eq, args: [], value: 41)], value: 0), (operator: Eq, args: [], value: 273)], value: 0), (operator: Eq, args: [], value: 460)], value: 0)], value: 0), (operator: Or, args: [(operator: And, args: [(operator: Or, args: [ (operator: Eq, args: [], value: 53), (operator: Eq, args: [], value: 54), (operator: Eq, args: [], value: 55), (operator: Eq, args: [], value: 56)], value: 0), (operator: Eq, args: [], value: 273)], value: 0), (operator: And, args: [( operator: Or, args: [(operator: Eq, args: [], value: 4), (operator: Eq, args: [], value: 41)], value: 0), (operator: Eq, args: [], value: 273)], value: 0)], value: 0)], value: 0)
- Source Edit
Procs
proc bindAsyncSocket(sock: AsyncFD; ma: MultiAddress): bool {....raises: [LPError], raises: [], tags: [RootEffect].}
-
Bind socket sock to MultiAddress ma.
Note: This procedure only used in go-libp2p-daemon wrapper.
Source Edit proc connect(ma: MultiAddress; bufferSize = DefaultStreamBufferSize; child: StreamTransport = nil; flags = default(set[SocketFlags]); localAddress: Opt[MultiAddress] = Opt.none(MultiAddress)): Future[ StreamTransport] {.stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- Open new connection to remote peer with address ma and create new transport object StreamTransport for established connection. bufferSize is size of internal buffer for transport. Source Edit
proc createAsyncSocket(ma: MultiAddress): AsyncFD {. ...raises: [ValueError, LPError], raises: [], tags: [RootEffect].}
-
Create new asynchronous socket using MultiAddress' ma socket type and protocol information.
Returns asyncInvalidSocket on error.
Note: This procedure only used in go-libp2p-daemon wrapper.
Source Edit proc createStreamServer[T](ma: MultiAddress; cbproc: StreamCallback; flags: set[ServerFlags] = {}; udata: ref T; sock: AsyncFD = asyncInvalidSocket; backlog: int = 100; bufferSize: int = DefaultStreamBufferSize; child: StreamServer = nil; init: TransportInitCallback = nil): StreamServer {. ...raises: [LPError, MaInvalidAddress], raises: [].}
- Create new TCP stream server which bounds to ma address. Source Edit
proc createStreamServer[T](ma: MultiAddress; flags: set[ServerFlags] = {}; udata: ref T; sock: AsyncFD = asyncInvalidSocket; backlog: int = 100; bufferSize: int = DefaultStreamBufferSize; child: StreamServer = nil; init: TransportInitCallback = nil): StreamServer {. ...raises: [LPError, MaInvalidAddress], raises: [].}
- Create new TCP stream server which bounds to ma address. Source Edit
proc getLocalAddress(sock: AsyncFD): TransportAddress {....raises: [], tags: [].}
-
Retrieve local socket sock address.
Note: This procedure only used in go-libp2p-daemon wrapper.
Source Edit proc initTAddress(ma: MultiAddress): MaResult[TransportAddress] {....raises: [], tags: [RootEffect].}
-
Initialize TransportAddress with MultiAddress ma.
MultiAddress must be wire address, e.g. {IP4, IP6, UNIX}/{TCP, UDP}.
Source Edit proc isPublicMA(ma: MultiAddress): bool {....raises: [], tags: [RootEffect].}
- Source Edit
Exports
-
mapAnd, maErr, writeSeq, DNS_OR_IP, UDP_IP, IP6, DNSANY, exclIfIt, hash, init, UDP_DNS, append, MaError, IPFS, data, WSS_IP, TranscoderOnion3, HTTPS, peekArray, MaPatternOp, CircuitRelay, isEmpty, QUIC_V1, WS_DNS, initVBuffer, TCP_IP, QUIC_V1_IP, contains, matchPartial, protocols, ==, Unreliable, readSeq, checkFutures, UNIX, QUIC_DNS, len, LPError, capLen, init, protoName, protoArgument, validate, TranscoderIP6, encode, protoCode, mapEq, [], MaPattern, TranscoderIP6Zone, $, MaResult, init, peekVarint, TranscoderP2P, protoArgument, initVBuffer, toException, init, TCP_DNS, mapOr, WSS_DNS, writeLPVarint, WebSockets_IP, compilesOr, WebRTCDirect, DNS6, WebSockets, TLS_WS, UDP, [], MaPatResult, QUIC, TranscoderOnion, QUIC_V1_DNS, IP4, TranscoderPort, UTP, withValue, safeConvert, shortLog, items, isEmpty, writeArray, WebSockets_DNS, WS_IP, withValue, public, MAKind, [], write, shortLog, DNSADDR, WSS, &, QUIC_IP, TranscoderDNS, initVBuffer, filterIt, match, TranscoderUnix, $, write, writePBVarint, valueOr, HTTP, TCP, IpTransportProtocol, finish, VBuffer, init, init, Onion3, TcpOnion3, init, getField, MultiAddress, &=, MAProtocol, readVarint, toOpt, init, $, IP, protoAddress, DNS4, readArray, TranscoderIP4, withValue, getRepeatedField, P2PPattern, MaInvalidAddress, toException, isEnough, concat, peekSeq, Reliable, hex, DNS, len, WS, high, toString, exceptionToAssert, writeVarint, bytes