bend-kit-wire Releases (14): 0.4.8.0 0x7d605d40b8b76e859de71949db4d2a89 indexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.8.0 0.4.7.0 0x20ad1e903f7e4d23c18051594e10a4f2 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.7.0 0.4.6.2 0xd485ef60af155080904f7d8f1e47cfe8 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.6.2 0.4.6.1 0x1afdf90dbe41c30b1df4594db039b02a unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.6.1 0.4.6.0 0x7322a00082d2cdc616a00f534e426eb2 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.6.0 0.4.5.0 0x1435aec27074c8141b74747909079afc unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.5.0 0.4.4.0 0x247a5ed9b007fd4a3007e764c6b14986 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.4.0 0.4.3.0 0x4e8235741fad6df1605249df49ecae86 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.3.0 0.4.2.0 0xa3dc0f6e3963608e4608a1017272cf4f unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.2.0 0.4.1.0 0xcd9eb2c24e7c1d3b2c89eb681085f7fe unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.1.0 0.4.0.5 0xb60955dac7deb87513099b118d6ca51a unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.0.5 0.4.0.4 0x9f95eaeefad4a8a2fe1a559163ffb14a unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.0.4 0.4.0.3 0x096635686408886b7d907f16c4550317 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.0.3 0.4.0.2 0xb481bb64f1136053b0a6b2c6da6277ab unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-wire@0.4.0.2 Definitions (23): Wire.connect (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=connect) # TCP connect to a numeric IPv4 or IPv6 address, with a deadline. def connect(host: String, port: U32, ms: U32) -> IO(Result<&1, &1, U32 & String, Socket>): Wire.listen (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=listen) # TCP listen on a numeric IPv4 or IPv6 address, nonblocking as Base TCP.listen. # Returns the listener and its bound port, so port 0 lets the OS pick one. def listen(host: String, port: U32) -> IO(Result<&1, &1, U32 & String, Listener & U32>): Wire.accept.deadline (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=accept.deadline) # One monotonic accept budget, ms: 1..2147483647. Every outcome returns the # actual listener; timeout leaves it usable. Cooperative scheduling does not # preempt arbitrary CPU work or blocking effects. def accept.deadline(listener: Listener, ms: U32) -> IO(Listener & Result<&1, &1, U32 & String, Socket>): Wire.recv (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=recv) # Octet-String TCP and UDP effects are the slow path: one Char cell per byte. def recv(sock: Socket, max: U32, ms: U32) -> IO(Socket & Result<&1, &1, U32 & String, String>): Wire.send (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=send) def send(sock: Socket, data: String) -> IO(Socket & Result<&1, &1, U32 & String, Unit>): Wire.idle (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=idle) # True when no byte and no end of stream waits on sock; it reads nothing. # False on an idle connection means the peer closed it or is out of step. def idle(sock: Socket) -> IO(Socket & Bool): Wire.recv_from (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=recv_from) def recv_from(sock: Socket, max: U32, ms: U32) -> IO(Socket & Result<&1, &1, U32 & String, String & U32 & String>): Wire.send_to (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=send_to) def send_to(sock: Socket, host: String, port: U32, data: String) -> IO(Socket & Result<&1, &1, U32 & String, Unit>): Wire.tls.connect (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=tls.connect) # TLS over a connected TCP socket (OpenSSL 3, loaded at run time; BEND_LIBSSL # overrides its path). The certificate chain and host name are always checked. def tls.connect(sock: Socket, host: String, ms: U32) -> IO(Socket & Result<&1, &1, U32 & String, Unit>): Wire.tls.connect.cert (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=tls.connect.cert) # Use a PEM certificate chain and its private key for mutual TLS. # A load failure is EINVAL; a handshake or server verification failure is EPROTO. def tls.connect.cert(sock: Socket, host: String, ms: U32, cert_path: String, key_path: String) -> IO(Socket & Result<&1, &1, U32 & String, Unit>): Wire.tls.connect.alpn (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=tls.connect.alpn) # protos is a comma-separated ALPN list (for example "h2,http/1.1"). def tls.connect.alpn(sock: Socket, host: String, ms: U32, protos: String) -> IO(Socket & Result<&1, &1, U32 & String, String>): Wire.tls.connect.ca (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=tls.connect.ca) # Trust the PEM certificates in ca_path for this handshake, instead of the # default verify paths. Verification stays on. A load failure is EINVAL. def tls.connect.ca(sock: Socket, host: String, ms: U32, ca_path: String) -> IO(Socket & Result<&1, &1, U32 & String, Unit>): Wire.tls.connect.alpn.ca (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=tls.connect.alpn.ca) # tls.connect.ca with a comma-separated ALPN list. The result is the selected protocol. def tls.connect.alpn.ca(sock: Socket, host: String, ms: U32, protos: String, ca_path: String) -> IO(Socket & Result<&1, &1, U32 & String, String>): Wire.tls.send (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=tls.send) # The String TLS effects are the slow path: one Char cell per octet. def tls.send(sock: Socket, data: String) -> IO(Socket & Result<&1, &1, U32 & String, Unit>): Wire.tls.recv (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=tls.recv) # "" once the peer sends close_notify. A bare EOF is an error. def tls.recv(sock: Socket, max: U32, ms: U32) -> IO(Socket & Result<&1, &1, U32 & String, String>): Wire.tls.close (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=tls.close) # Ends the TLS session and closes the socket. def tls.close(sock: Socket) -> IO(Unit): Wire.recv.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=recv.words) # The .words forms move (len, words): bytes packed four to a U32, laid out as # bytes/bytes.bend packs them, so no String cell is made per byte. def recv.words(sock: Socket, max: U32, ms: U32) -> IO(Socket & Result<&1, &1, U32 & String, U32 & Array>): Wire.send.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=send.words) # len past the end of words fails with EINVAL. def send.words(sock: Socket, len: U32, words: Array) -> IO(Socket & Result<&1, &1, U32 & String, Unit>): Wire.send.words.deadline (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=send.words.deadline) # Total write budget, including packing; ms must be 1..2147483647. # Returns socket, bytes accepted locally, and outcome on every path. Consumes # words on every path. Timeout/disconnect may leave a sent prefix: close the # returned socket, do not replay the whole buffer. Success is not peer receipt. def send.words.deadline(sock: Socket, len: U32, words: Array, ms: U32) -> IO(Socket & (U32 & Result<&1, &1, U32 & String, Unit>)): Wire.recv_from.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=recv_from.words) # UDP keeps the sender address and port beside the packed datagram. def recv_from.words(sock: Socket, max: U32, ms: U32) -> IO(Socket & Result<&1, &1, U32 & String, String & U32 & (U32 & Array)>): Wire.send_to.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=send_to.words) # len past the end of words fails with EINVAL. def send_to.words(sock: Socket, host: String, port: U32, len: U32, words: Array) -> IO(Socket & Result<&1, &1, U32 & String, Unit>): Wire.tls.recv.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=tls.recv.words) # len 0 once the peer sends close_notify. def tls.recv.words(sock: Socket, max: U32, ms: U32) -> IO(Socket & Result<&1, &1, U32 & String, U32 & Array>): Wire.tls.send.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-wire@0.4.8.0/wire.bend&name=tls.send.words) def tls.send.words(sock: Socket, len: U32, words: Array) -> IO(Socket & Result<&1, &1, U32 & String, Unit>):