// Generated using `moon info`, DON'T EDIT IT package "experiments/moon_i2p/streaming" import { "experiments/moon_i2p/common", "experiments/moon_i2p/crypto", "experiments/moon_i2p/encoding", "moonbitlang/core/debug", } // Values pub fn decode_i2cp_streaming(Bytes, peer_sig_type? : @common.SigningPublicKeyType) -> (@encoding.I2cpGzipHeader, StreamingPacket) raise StreamingError pub fn decode_raw_datagram(Bytes) -> (@encoding.I2cpGzipHeader, Bytes) raise StreamingError pub fn encode_i2cp_streaming(StreamingPacket, from_port? : UInt32, to_port? : UInt32) -> Bytes raise StreamingError pub fn encode_raw_datagram(Bytes, from_port? : UInt32, to_port? : UInt32) -> Bytes pub let flag_close : UInt32 pub let flag_delay_requested : UInt32 pub let flag_echo : UInt32 pub let flag_from_included : UInt32 pub let flag_max_packet_size_included : UInt32 pub let flag_no_ack : UInt32 pub let flag_offline_signature : UInt32 pub let flag_profile_interactive : UInt32 pub let flag_reset : UInt32 pub let flag_signature_included : UInt32 pub let flag_signature_requested : UInt32 pub let flag_synchronize : UInt32 // Errors #derive(Eq, @debug.Debug) pub suberror StreamingError { Encoding(@encoding.EncodingError) Common(@common.CommonError) Crypto(@crypto.CryptoError) InvalidFormat(String) InvalidLength(String) InvalidSignature ProtocolError(String) } // Types and methods #derive(Eq, @debug.Debug) pub(all) struct RepliableDatagram { sender : @common.Destination signature : Bytes payload : Bytes } pub fn RepliableDatagram::decode(Bytes) -> Self raise StreamingError pub fn RepliableDatagram::encode(Self) -> Bytes pub fn RepliableDatagram::from_i2cp_bytes(Bytes) -> (@encoding.I2cpGzipHeader, Self) raise StreamingError pub fn RepliableDatagram::sign_ed25519(@common.Destination, Bytes, Bytes) -> Self raise StreamingError pub fn RepliableDatagram::to_i2cp_bytes(Self, from_port? : UInt32, to_port? : UInt32) -> Bytes pub fn RepliableDatagram::verify(Self) -> Bool pub struct StreamConnection { local_dest : @common.Destination local_ed_seed : Bytes mut remote_dest : @common.Destination? mut remote_hash : @common.Hash from_port : UInt32 to_port : UInt32 send_stream_id : UInt32 mut recv_stream_id : UInt32 mut state : StreamState mut next_send_seq : UInt32 mut highest_acked_seq : UInt32 mut has_acked : Bool mut next_recv_seq : UInt32 mut ack_through : UInt32 mut has_recv_syn : Bool mut max_packet_size : UInt32 window_size : Int32 ooo_recv : Array[(UInt32, Bytes)] recv_buf : Array[Byte] mut peer_closed : Bool out_queue : Array[Bytes] // private fields } pub fn StreamConnection::accept_syn(@common.Destination, Bytes, StreamingPacket, UInt32, UInt64, from_port? : UInt32, to_port? : UInt32) -> Self raise StreamingError pub fn StreamConnection::close(Self, UInt64) -> Unit raise StreamingError pub fn StreamConnection::connect(@common.Destination, Bytes, @common.Hash, UInt32, UInt64, from_port? : UInt32, to_port? : UInt32, max_packet_size? : UInt32) -> Self raise StreamingError pub fn StreamConnection::drain_outbound(Self) -> Array[Bytes] pub fn StreamConnection::has_unacked(Self) -> Bool pub fn StreamConnection::is_eof(Self) -> Bool pub fn StreamConnection::on_packet(Self, StreamingPacket, UInt64) -> Unit raise StreamingError pub fn StreamConnection::poll_retransmits(Self, UInt64, rto_ms? : UInt64) -> Unit raise StreamingError pub fn StreamConnection::read_available(Self) -> Bytes pub fn StreamConnection::write(Self, Bytes, UInt64) -> Int32 raise StreamingError pub struct StreamManager { local_dest : @common.Destination local_ed_seed : Bytes mut next_stream_id : UInt32 streams : Array[StreamConnection] pending_accept : Array[StreamConnection] incoming_datagrams : Array[RepliableDatagram] } pub fn StreamManager::accept_next(Self) -> StreamConnection? pub fn StreamManager::connect(Self, @common.Hash, UInt64, from_port? : UInt32, to_port? : UInt32) -> StreamConnection raise StreamingError pub fn StreamManager::handle_incoming_i2cp(Self, Bytes, UInt64) -> StreamConnection? raise StreamingError pub fn StreamManager::new(@common.Destination, Bytes, initial_stream_id? : UInt32) -> Self #derive(Eq, @debug.Debug) pub(all) enum StreamState { SynSent SynReceived Established Closing Closed Reset } #derive(Eq, @debug.Debug) pub(all) struct StreamingPacket { send_stream_id : UInt32 recv_stream_id : UInt32 sequence_num : UInt32 ack_through : UInt32 nacks : Array[UInt32] resend_delay : Byte flags : UInt32 delay_requested : UInt32? from_dest : @common.Destination? max_packet_size : UInt32? offline_sig : @common.OfflineSignature? signature : Bytes? payload : Bytes } pub fn StreamingPacket::decode(Bytes, peer_sig_type? : @common.SigningPublicKeyType) -> Self raise StreamingError pub fn StreamingPacket::encode(Self) -> Bytes raise StreamingError pub fn StreamingPacket::sign_ed25519(Self, Bytes) -> Self raise StreamingError pub fn StreamingPacket::verify_signature(Self, @common.Destination) -> Bool // Type aliases // Traits