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: 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: 461)], 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: 461)], 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)): InternalRaisesFuture[ StreamTransport, (MaInvalidAddress, TransportError, CancelledError, LPError)] {. 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
-
DNS_OR_IP, contains, exclIfIt, hash, readSeq, data, UDP_DNS, MaError, IPFS, MaPatternOp, isEmpty, WS_DNS, initVBuffer, hex, protocols, bytes, ==, HTTPS, UNIX, filterIt, QUIC_DNS, LPError, TranscoderIP6, encode, MaResult, init, peekVarint, mapOr, writeSeq, &, Memory, DNS6, TLS_WS, TranscoderDNS, QUIC, [], [], IP4, TranscoderPort, withValue, safeConvert, $, WS_IP, withValue, public, MAKind, valueOr, TranscoderOnion3, getRepeatedField, matchPartial, protoArgument, match, WebSockets_DNS, WebSockets, $, isEmpty, HTTP, finish, init, TcpOnion3, MAProtocol, peekSeq, toOpt, concat, IP, protoAddress, DNS4, QUIC_V1_IP, readArray, withValue, P2PPattern, isEnough, Reliable, len, WS, CircuitRelay, mapAnd, maErr, UDP_IP, DNSANY, DNSADDR, append, write, WSS_IP, peekArray, WSS, QUIC_V1, TCP_IP, getField, Unreliable, checkFutures, TCP_DNS, capLen, init, protoName, IpTransportProtocol, validate, mapEq, Onion3, MaPattern, MaInvalidAddress, TranscoderP2P, toException, WSS_DNS, writeLPVarint, write, WebRTCDirect, len, UDP, TranscoderIP6Zone, MaPatResult, TranscoderOnion, QUIC_V1_DNS, init, shortLog, writeArray, init, UTP, [], IP6, shortLog, initVBuffer, QUIC_IP, initVBuffer, WebSockets_IP, VBuffer, writePBVarint, TCP, protoArgument, init, init, MultiAddress, &=, readVarint, compilesOr, TranscoderMemory, TranscoderIP4, init, protoCode, $, toException, DNS, items, TranscoderUnix, high, toString, writeVarint