Files
moon-i2p/tunnel/pkg.generated.mbti
T

140 lines
3.9 KiB
Plaintext

// Generated using `moon info`, DON'T EDIT IT
package "experiments/moon_i2p/tunnel"
import {
"experiments/moon_i2p/common",
"experiments/moon_i2p/crypto",
"experiments/moon_i2p/encoding",
"experiments/moon_i2p/noise",
"moonbitlang/core/debug",
}
// Values
pub fn decrypt_short_build_record(Bytes, @common.Hash, @noise.KeyPair) -> (ShortBuildRequestRecord, HopKeys) raise TunnelError
pub fn decrypt_short_build_reply(HopKeys, Bytes) -> Byte raise TunnelError
pub fn encrypt_short_build_record(ShortBuildRequestRecord, @common.Hash, Bytes, @noise.KeyPair) -> (Bytes, HopKeys) raise TunnelError
pub fn encrypt_short_build_reply(HopKeys, Byte) -> Bytes raise TunnelError
pub fn fragment_message_to_cells(DeliveryTarget, UInt32, Bytes, Bytes) -> Array[Bytes] raise TunnelError
pub fn pack_tunnel_cell(Bytes, Array[TunnelFragment]) -> Bytes raise TunnelError
pub fn tunnel_layer_decrypt(Bytes, Bytes, Bytes) -> Bytes raise TunnelError
pub fn tunnel_layer_encrypt(Bytes, Bytes, Bytes) -> Bytes raise TunnelError
pub fn unpack_tunnel_cell(Bytes) -> Array[TunnelFragment] raise TunnelError
// Errors
#derive(Eq, @debug.Debug)
pub suberror TunnelError {
Crypto(@crypto.CryptoError)
Encoding(@encoding.EncodingError)
Common(@common.CommonError)
InvalidLength(String)
InvalidFormat(String)
ChecksumMismatch
RecordNotForUs
}
// Types and methods
#derive(Eq, @debug.Debug)
pub(all) enum DeliveryTarget {
Local
Tunnel(tunnel_id~ : UInt32, gateway~ : @common.Hash)
Router(router_hash~ : @common.Hash)
}
pub struct FragmentReassembler {
// private fields
}
pub fn FragmentReassembler::new() -> Self
pub fn FragmentReassembler::push(Self, TunnelFragment) -> (DeliveryTarget, Bytes)?
#derive(Eq, @debug.Debug)
pub(all) struct HopKeys {
reply_key : Bytes
layer_key : Bytes
iv_key : Bytes
handshake_hash : Bytes
}
#derive(Eq, @debug.Debug)
pub(all) struct ShortBuildRequestRecord {
receive_tunnel_id : UInt32
next_tunnel_id : UInt32
next_ident : @common.Hash
flag : Byte
layer_enc_type : Byte
request_time_min : UInt32
request_expiration_sec : UInt32
send_message_id : UInt32
options : @common.Mapping
}
pub fn ShortBuildRequestRecord::decode_154(Bytes) -> Self raise TunnelError
pub fn ShortBuildRequestRecord::encode_154(Self) -> Bytes raise TunnelError
#derive(Eq, @debug.Debug)
pub(all) struct TransitHop {
receive_tunnel_id : UInt32
next_tunnel_id : UInt32
next_router : @common.Hash
layer_key : Bytes
iv_key : Bytes
is_obep : Bool
expires_sec : UInt32
}
#derive(Eq, @debug.Debug)
pub(all) struct Tunnel {
id : UInt32
direction : TunnelDirection
hops : Array[TunnelHop]
created_sec : UInt32
expires_sec : UInt32
}
pub fn Tunnel::decrypt_inbound_cell(Self, Bytes) -> Bytes raise TunnelError
pub fn Tunnel::prepare_outbound_cell(Self, Bytes) -> Bytes raise TunnelError
#derive(Eq, @debug.Debug)
pub(all) enum TunnelDirection {
Inbound
Outbound
}
#derive(Eq, @debug.Debug)
pub(all) enum TunnelFragment {
First(target~ : DeliveryTarget, fragmented~ : Bool, msg_id~ : UInt32, data~ : Bytes)
FollowOn(frag_num~ : Int32, is_last~ : Bool, msg_id~ : UInt32, data~ : Bytes)
}
#derive(Eq, @debug.Debug)
pub(all) struct TunnelHop {
router_hash : @common.Hash
receive_tunnel_id : UInt32
next_tunnel_id : UInt32
layer_key : Bytes
iv_key : Bytes
}
pub struct TunnelManager {
inbound : Array[Tunnel]
outbound : Array[Tunnel]
transit : Array[TransitHop]
}
pub fn TunnelManager::add_transit_hop(Self, TransitHop) -> Unit
pub fn TunnelManager::add_tunnel(Self, Tunnel) -> Unit
pub fn TunnelManager::inbound_count(Self) -> Int32
pub fn TunnelManager::new() -> Self
pub fn TunnelManager::outbound_count(Self) -> Int32
pub fn TunnelManager::prune_expired(Self, UInt32) -> Int32
pub fn TunnelManager::relay_cell(Self, UInt32, Bytes) -> (@common.Hash, UInt32, Bytes, Bool)? raise TunnelError
pub fn TunnelManager::transit_count(Self) -> Int32
// Type aliases
// Traits