feat: add pure-MoonBit NetDB and Floodfill Kademlia DHT
This commit is contained in:
1 parent
e6d1c464dd
commit
4993741355
4 files changed
+611
No files matched your search
@@ -0,0 +1,49 @@
|
||||
// Generated using `moon info`, DON'T EDIT IT
|
||||
package "experiments/moon_i2p/netdb"
|
||||
|
||||
import {
|
||||
"experiments/moon_i2p/common",
|
||||
"experiments/moon_i2p/i2np",
|
||||
"moonbitlang/core/debug",
|
||||
}
|
||||
|
||||
// Values
|
||||
pub fn compare_distance(Bytes, Bytes) -> Int32
|
||||
|
||||
pub fn format_utc_date(UInt64) -> String
|
||||
|
||||
pub fn is_floodfill(@common.RouterInfo) -> Bool
|
||||
|
||||
pub fn routing_key(@common.Hash, String) -> @common.Hash
|
||||
|
||||
pub fn xor_distance(@common.Hash, @common.Hash) -> Bytes
|
||||
|
||||
// Errors
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub suberror NetDbError {
|
||||
Common(@common.CommonError)
|
||||
InvalidSignature(String)
|
||||
InvalidRecord(String)
|
||||
}
|
||||
|
||||
// Types and methods
|
||||
pub struct NetDb {
|
||||
routers : Array[(@common.Hash, @common.RouterInfo)]
|
||||
leasesets : Array[(@common.Hash, @common.LeaseSet2)]
|
||||
}
|
||||
pub fn NetDb::closest_peers(Self, @common.Hash, String, Int32, floodfills_only? : Bool, excluded? : Array[@common.Hash]) -> Array[@common.RouterInfo]
|
||||
pub fn NetDb::get_lease_set2(Self, @common.Hash, UInt32) -> @common.LeaseSet2?
|
||||
pub fn NetDb::get_lease_set2_by_b32(Self, String, UInt32) -> @common.LeaseSet2?
|
||||
pub fn NetDb::get_router_info(Self, @common.Hash) -> @common.RouterInfo?
|
||||
pub fn NetDb::handle_database_lookup(Self, @common.Hash, @common.Hash, Byte, Array[@common.Hash], UInt32, max_peers? : Int32) -> @i2np.I2npPayload raise NetDbError
|
||||
pub fn NetDb::handle_database_store(Self, Byte, @common.Hash, Bytes, UInt32) -> Bool raise NetDbError
|
||||
pub fn NetDb::leaseset_count(Self) -> Int32
|
||||
pub fn NetDb::new() -> Self
|
||||
pub fn NetDb::prune_expired(Self, UInt32) -> Int32
|
||||
pub fn NetDb::router_count(Self) -> Int32
|
||||
pub fn NetDb::store_lease_set2(Self, @common.LeaseSet2, UInt32) -> Bool raise NetDbError
|
||||
pub fn NetDb::store_router_info(Self, @common.RouterInfo) -> Bool raise NetDbError
|
||||
|
||||
// Type aliases
|
||||
|
||||
// Traits
|
||||
Reference in new issue
Block a user