TZH-nh/moonwire/protocol does not have a README file
pub(all) suberror ProtocolError {
InvalidKeyLength(field~ : String, actual~ : Int)
InvalidMac1
InvalidMac2
CookieRequired
HandshakeDecryptionFailed(stage~ : String)
UnknownPeer(Bytes)
ReplayedOrStaleTimestamp
UnexpectedHandshakeResponse(UInt)
MalformedTimestamp
Crypto(CryptoError)
Packet(PacketError)
NoActiveSession
UnknownReceiverIndex(UInt)
ReplayedOrTooOldPacket(UInt64)
CounterExhausted
InvalidSourceIp(IpAddr)
UnroutableDestination(IpAddr)
} derive(Eq, Debug)fn CookieValidator::compute_cookie(self : CookieValidator, peer_endpoint_bytes : BytesView, now_ms : UInt64) -> Bytesfn CookieValidator::create_cookie_reply(self : CookieValidator, sender_index : UInt, triggering_mac1 : BytesView, peer_endpoint_bytes : BytesView, now_ms : UInt64, explicit_nonce24? : BytesView) -> CookieReply raise ProtocolErrorfn CookieValidator::new(local_static_public : BytesView, secret_seed : BytesView, now_ms : UInt64) -> CookieValidator raise ProtocolErrorfn CookieValidator::verify_initiation_mac2(self : CookieValidator, msg : HandshakeInitiation, peer_endpoint_bytes : BytesView, now_ms : UInt64) -> Boolfn CookieValidator::verify_response_mac2(self : CookieValidator, msg : HandshakeResponse, peer_endpoint_bytes : BytesView, now_ms : UInt64) -> Boolpub struct Device {
local_static_private : Bytes
local_static_public : Bytes
cookies : CookieValidator
routing : RoutingTable[Int]
peers : Array[PeerTunnel]
// private fields
}fn Device::add_peer(self : Device, remote_static_public : BytesView, allowed_ips : Array[Cidr], preshared_key? : BytesView, persistent_keepalive_ms? : UInt64) -> Int raise ProtocolErrorfn Device::new(local_static_private : BytesView, entropy_seed : BytesView, now_ms : UInt64) -> Device raise ProtocolErrorfn Device::receive_wire(self : Device, wire_bytes : BytesView, now_ms : UInt64, under_load? : Bool, peer_endpoint_bytes? : BytesView) -> (Int, TunnelAction, Array[Bytes]) raise ProtocolErrorfn Device::route_and_encapsulate(self : Device, inner_ip : BytesView, now_ms : UInt64) -> (Int, Array[Bytes]) raise ProtocolErrorpub struct PeerTunnel {
local_static_private : Bytes
local_static_public : Bytes
remote_static_public : Bytes
preshared_key : Bytes?
persistent_keepalive_ms : UInt64?
// private fields
}fn PeerTunnel::decapsulate(self : PeerTunnel, wire_bytes : BytesView, now_ms : UInt64, under_load? : Bool, cookie_validator? : CookieValidator, peer_endpoint_bytes? : BytesView) -> (TunnelAction, Array[Bytes]) raise ProtocolErrorfn PeerTunnel::encapsulate(self : PeerTunnel, inner_ip : BytesView, now_ms : UInt64) -> Array[Bytes] raise ProtocolErrorfn PeerTunnel::new(local_static_private : BytesView, remote_static_public : BytesView, entropy_seed : BytesView, initial_index? : UInt, preshared_key? : BytesView, persistent_keepalive_ms? : UInt64) -> PeerTunnel raise ProtocolErrorpub struct TransportSession {
local_index : UInt
remote_index : UInt
send_key : Bytes
recv_key : Bytes
is_initiator : Bool
created_ms : UInt64
send_counter : UInt64
replay : ReplayWindow
} derive(Eq, Debug)let COOKIE_REFRESH_MS : UInt64let REKEY_AFTER_TIME_MS : UInt64fn compute_cookie_key(peer_static_public : BytesView) -> Bytesfn compute_mac1_key(peer_static_public : BytesView) -> Bytesfn consume_cookie_reply(reply : CookieReply, remote_static_public : BytesView, last_sent_mac1 : BytesView) -> Bytes raise ProtocolErrorfn consume_handshake_initiation(msg : HandshakeInitiation, responder_static_private : BytesView) -> ConsumedInitiation raise ProtocolErrorfn consume_handshake_response(state : InitiatorHandshake, msg : HandshakeResponse) -> DerivedSessionKeys raise ProtocolErrorfn create_handshake_initiation(local_static_private : BytesView, remote_static_public : BytesView, ephemeral_private : BytesView, sender_index : UInt, timestamp : Tai64n, preshared_key? : BytesView, cookie? : BytesView) -> (HandshakeInitiation, InitiatorHandshake) raise ProtocolErrorfn create_handshake_response(consumed : ConsumedInitiation, responder_ephemeral_private : BytesView, responder_index : UInt, preshared_key? : BytesView, cookie? : BytesView) -> (HandshakeResponse, DerivedSessionKeys) raise ProtocolErrorfn initial_noise_state() -> (Bytes, Bytes)fn seal_transport_packet(remote_index : UInt, send_key : BytesView, counter : UInt64, inner_ip_or_empty : BytesView) -> TransportData raise ProtocolErrorInstall
Download zipUserspace Sans-IO WireGuard protocol engine, configuration auditor, and PCAP packet decryptor in pure MoonBit.