6 namespace org { namespace ldk { namespace structs {
10 * A [`MessageRouter`] that can only route to a directly connected [`Destination`].
14 * Creating [`BlindedMessagePath`]s may affect privacy since, if a suitable path cannot be found,
15 * it will create a one-hop path using the recipient as the introduction node if it is a announced
16 * node. Otherwise, there is no way to find a path to the introduction node in order to send a
17 * message, and thus an `Err` is returned.
19 public class DefaultMessageRouter : CommonBase {
20 internal DefaultMessageRouter(object _dummy, long ptr) : base(ptr) { }
21 ~DefaultMessageRouter() {
22 if (ptr != 0) { bindings.DefaultMessageRouter_free(ptr); }
26 * Creates a [`DefaultMessageRouter`] using the given [`NetworkGraph`].
28 public static DefaultMessageRouter of(org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.EntropySource entropy_source) {
29 long ret = bindings.DefaultMessageRouter_new(network_graph.ptr, entropy_source.ptr);
30 GC.KeepAlive(network_graph);
31 GC.KeepAlive(entropy_source);
32 if (ret >= 0 && ret <= 4096) { return null; }
33 org.ldk.structs.DefaultMessageRouter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DefaultMessageRouter(null, ret); }
34 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
35 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(network_graph); };
36 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(entropy_source); };
41 * Constructs a new MessageRouter which calls the relevant methods on this_arg.
42 * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is
44 public MessageRouter as_MessageRouter() {
45 long ret = bindings.DefaultMessageRouter_as_MessageRouter(this.ptr);
47 if (ret >= 0 && ret <= 4096) { return null; }
48 MessageRouter ret_hu_conv = new MessageRouter(null, ret);
49 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };