DTN controller and policy language for satellite networks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

btree: add cell, page, pager, record, table, varint modules

borealis: add example yaml configs
sqlite: update interop test

+50 -10
+34 -10
bin/borealis.ml
··· 27 27 Eio_main.run @@ fun env -> 28 28 Eio.Switch.run @@ fun sw -> 29 29 let clock = Eio.Stdenv.clock env in 30 - let config, contact_plan, peers = 30 + let config, contact_plan, peers, port = 31 31 match config_file with 32 32 | Some file -> ( 33 33 match Config.load file with 34 34 | Ok c -> 35 35 let plan = Config.to_contact_plan c in 36 - (Engine.make_config ~node_id:c.node_id, plan, c.peers) 36 + (Engine.make_config ~node_id:c.node_id, plan, c.peers, c.port) 37 37 | Error e -> 38 38 Log.err (fun m -> m "Failed to load config: %s" e); 39 - (Engine.make_config ~node_id, Cgr.Contact_plan.empty, [])) 40 - | None -> (Engine.make_config ~node_id, Cgr.Contact_plan.empty, []) 39 + ( Engine.make_config ~node_id, 40 + Cgr.Contact_plan.empty, 41 + [], 42 + listen_port )) 43 + | None -> 44 + (Engine.make_config ~node_id, Cgr.Contact_plan.empty, [], listen_port) 41 45 in 42 46 let engine = Engine.create ~config ~policy:default_policy ~contact_plan in 43 47 let daemon = Daemon.create ~engine in ··· 49 53 peers; 50 54 let net = Eio.Stdenv.net env in 51 55 Log.app (fun m -> 52 - m "Borealis starting: node=%Ld port=%d peers=%d" node_id listen_port 53 - (List.length peers)); 56 + m "Borealis starting: node=%s port=%d peers=%d" 57 + (Cgr.Node.name config.local_node) 58 + port (List.length peers)); 54 59 Log.info (fun m -> m "Local EID: %a" Bundle.pp_eid config.local_eid); 55 - Daemon.run daemon ~sw ~net ~clock ~port:listen_port 60 + Daemon.run daemon ~sw ~net ~clock ~port 56 61 57 62 let node_id_opt = 58 63 let doc = "Node ID (IPN scheme node number)." in ··· 94 99 { 95 100 version = 7; 96 101 flags = Bundle.bundle_flags_default; 97 - crc_type = Bundle.Crc_none; 102 + crc_type = Bundle.No_crc; 98 103 destination; 99 104 source; 100 105 report_to = source; ··· 109 114 block_type = Payload; 110 115 block_number = 1; 111 116 flags = Bundle.block_flags_default; 112 - crc_type = Bundle.Crc_none; 117 + crc_type = Bundle.No_crc; 113 118 data = Payload_data payload; 114 119 } 115 120 in 116 121 let bundle : Bundle.t = { primary; blocks = [ payload_block ] } in 117 - let addr = `Tcp (Eio.Net.Ipaddr.of_raw dest_host, dest_port) in 122 + let ipaddr = 123 + if dest_host = "127.0.0.1" || dest_host = "localhost" then 124 + Eio.Net.Ipaddr.V4.loopback 125 + else 126 + (* Parse IPv4 address string like "192.168.1.1" *) 127 + let parts = String.split_on_char '.' dest_host in 128 + match List.map int_of_string parts with 129 + | [ a; b; c; d ] -> 130 + let raw = 131 + String.init 4 (fun i -> 132 + match i with 133 + | 0 -> Char.chr a 134 + | 1 -> Char.chr b 135 + | 2 -> Char.chr c 136 + | _ -> Char.chr d) 137 + in 138 + Eio.Net.Ipaddr.of_raw raw 139 + | _ -> failwith ("Invalid IP address: " ^ dest_host) 140 + in 141 + let addr = `Tcp (ipaddr, dest_port) in 118 142 Log.info (fun m -> m "Connecting to %s:%d..." dest_host dest_port); 119 143 let conn = Tcpcl_adapter.connect ~sw ~net ~local_eid:source ~addr in 120 144 if Tcpcl_adapter.is_connected conn then (
+8
examples/node1.yaml
··· 1 + # Borealis Node 1 configuration 2 + node_id: 1 3 + port: 4556 4 + peers: 5 + - node_id: 2 6 + host: "127.0.0.1" 7 + port: 4557 8 + contacts: []
+8
examples/node2.yaml
··· 1 + # Borealis Node 2 configuration 2 + node_id: 2 3 + port: 4557 4 + peers: 5 + - node_id: 1 6 + host: "127.0.0.1" 7 + port: 4556 8 + contacts: []