module

Hop::FFI

Thin, one-to-one helpers over LibHop: turn raw pointers + synchronous sink callbacks into Crystal Bytes/String/arrays. Everything ergonomic lives in Hop::Endpoint.

Constants

ABI_EXPECTED = 7_u32

Class methods

accept_inbox(node : Pointer(Void), inbox_id : Bytes) : Bool
Source
accept_service_request(node : Pointer(Void), request_id : Bytes) : Bool
Source
accept_service_response(node : Pointer(Void), request_id : Bytes) : Bool
Source
address(node : Pointer(Void)) : Bytes
Source
assert_abi!
Source
cluster_join(node : Pointer(Void), secret : Bytes) : Nil
Source
cluster_join_passphrase(node : Pointer(Void), pass : Bytes) : Nil
Source
cluster_mark_done(node : Pointer(Void), from : Bytes, request_id : Bytes) : Nil
Source
cluster_members(node : Pointer(Void)) : UInt32
Source
cluster_set_quorum(node : Pointer(Void), min : UInt32) : Nil
Source
cluster_would_drop(node : Pointer(Void), from : Bytes, request_id : Bytes) : Bool
Source
drain_outgoing(node : Pointer(Void)) : Array(Tuple(UInt64, Bytes))
Source
from_b58(text : String) : Bytes
Source
node_free(node : Pointer(Void)) : Nil
Source
node_is_encrypted(node : Pointer(Void)) : Bool
Source
node_is_persistent(node : Pointer(Void)) : Bool
Source
node_new

---- thin wrappers ----

Source
node_open(db_path : String, secret : Bytes | Nil = nil, app_secret : Bytes | Nil = nil) : Pointer(Void)
Source
node_open_keyed(db_path : String, secret : Bytes | Nil = nil, app_secret : Bytes | Nil = nil, key : Bytes | Nil = nil) : Pointer(Void)
Source
node_with_secret(secret : Bytes) : Pointer(Void)
Source
publish_prekey(node : Pointer(Void)) : Bool
Source
read_bytes(ptr : Pointer(UInt8), len : LibC::SizeT) : Bytes

---- read C memory that is valid only during a call ----

Source
read_cstr(ptr : Pointer(LibC::Char)) : String
Source
reject_service_request(node : Pointer(Void), request_id : Bytes) : Bool
Source
relay_add(node : Pointer(Void), url : String, configured : Bool = true) : Bool
Source
relay_next(node : Pointer(Void)) : String | Nil

The relay to dial right now, or nil when there is nothing dialable. nil with a non-zero relay_pool total is the degraded "every candidate is backed off" state (wait and retry, this is not offline); nil with a zero total is an empty pool. The 2 KiB buffer is far past any real endpoint URL; the C call writes nothing and returns 0 if a URL would not fit.

Source
relay_pool(node : Pointer(Void)) : Tuple(Int32, Int32)

{total pooled endpoints, how many are dialable right now}.

Source
relay_report(node : Pointer(Void), url : String, ok : Bool) : Nil
Source
send_service_request(node : Pointer(Void), dst : Bytes, service : String, method : String, args : Bytes) : Bytes
Source
send_service_response(node : Pointer(Void), to : Bytes, for_request_id : Bytes, status : UInt16, body : Bytes) : Bool
Source
sign_reach(node : Pointer(Void), endpoint : String, ttl_secs : UInt32) : Bytes
Source
subscribe(node : Pointer(Void), topic : String) : Nil
Source
take_service_requests(node : Pointer(Void)) : Array(Tuple(Bytes, Bytes, String, String, Bytes))

[{from32, request_id32, service, method, args}]

Source
take_service_responses(node : Pointer(Void)) : Array(Tuple(Bytes, Bytes, UInt16, Bytes))

[{from32, for_request_id32, status, body}]

Source
tick(node : Pointer(Void), now_ms : UInt64) : Nil
Source
to_b58(addr32 : Bytes) : String
Source
verify_reach(record : Bytes, now_secs : UInt64) : Reach | Nil
Source

Nested types