moonbitstack/moonnet/udp does not have a README file

    QuicRefused

    pub(all) suberror QuicRefused {
    Timeout
    Broken(String)
    Closed
    } derive(Eq,
    Debug
    )

    What a QUIC connection will not do.

    QuicRefused::equal

    fn QuicRefused::equal(QuicRefused, QuicRefused) -> Bool

    QuicRefused::not_equal

    fn QuicRefused::not_equal(x : QuicRefused, y : QuicRefused) -> Bool

    Quic

    pub struct Quic {
    socket : Socket
    to :
    Addr

    client :
    Client

    bi : UInt64
    uni : UInt64
    dead : Bool
    seen : Map[UInt64, Bool]
    }

    A QUIC connection driven by one task: the client half of what moonquic states and this package puts on a datagram socket. Reading is a poll, because a connection that also carries control and QPACK streams cannot hand every arrival to one caller.

    Quic::alpn

    fn Quic::alpn(self : Quic) -> String?

    The ALPN the handshake settled on.

    Quic::close

    fn Quic::close(self : Quic) -> Unit

    Close the socket the connection runs on.

    Quic::ended

    fn Quic::ended(self : Quic, stream : UInt64) -> Bool

    Whether the peer has ended stream, with every octet of it read.

    Quic::open_bi

    fn Quic::open_bi(self : Quic) -> UInt64

    The next bidirectional stream this side opens: 0, 4, 8, … as RFC 9000 §2.1 numbers them.

    Quic::open_uni

    fn Quic::open_uni(self : Quic) -> UInt64

    The next unidirectional stream, from 2 upwards.

    Quic::step

    async fn Quic::step(self : Quic, timeout? : Int) -> Bool raise QuicRefused

    Send what the connection has queued and take one datagram in, which is one turn of a handshake or of an exchange. False when nothing arrived within timeout.

    Quic::take

    fn Quic::take(self : Quic, stream : UInt64) -> Bytes

    The octets that arrived on stream since the last call; empty when none have.

    Quic::write

    fn Quic::write(self : Quic, stream : UInt64, bytes : Bytes, fin? : Bool) -> Unit

    Put bytes on stream, and end it when fin.

    Socket

    A datagram socket. One task may receive while others send; two tasks receiving at once would each take half the datagrams, so a connection that needs one reader keeps one.

    Socket::addr

    The address bound; with port 0 asked for, the port the system chose.

    Socket::close

    fn Socket::close(self : Socket) -> Unit

    Stop using the socket.

    Socket::recv

    async fn Socket::recv(self : Socket, max? : Int, timeout? : Int) -> (Bytes,
    Addr
    )?

    The next datagram, or None when timeout milliseconds pass first. Without a timeout it waits for one, which is what a server does and a client polling a handshake does not.

    Socket::send

    async fn Socket::send(self : Socket, to :
    Addr
    , bytes : Bytes) -> Unit

    Send one datagram.

    bind

    async fn bind(host? : String, port? : Int) -> Socket

    Bind host:port. Port 0 asks the system for a free one, which addr reports.

    dial

    async fn dial(host : String, port~ : Int, tls~ :
    Client
    , idle? : UInt64) -> Quic

    Connect to host:port and shake hands. The connection is returned once the handshake is confirmed; tls offers h3 or whatever ALPN the peer is expected to choose.

    now

    fn now() -> Int64

    The clock QUIC counts in, milliseconds since the epoch.

    Source Files