@@ -5,6 +5,7 @@ use std::net::SocketAddr;
5
5
use topology:: NymTopology ;
6
6
7
7
pub const LOOP_COVER_MESSAGE_PAYLOAD : & [ u8 ] = b"The cake is a lie!" ;
8
+ pub const LOOP_COVER_MESSAGE_AVERAGE_DELAY : f64 = 2.0 ;
8
9
9
10
pub fn loop_cover_message < T : NymTopology > (
10
11
our_address : DestinationAddressBytes ,
@@ -13,21 +14,25 @@ pub fn loop_cover_message<T: NymTopology>(
13
14
) -> ( SocketAddr , SphinxPacket ) {
14
15
let destination = Destination :: new ( our_address, surb_id) ;
15
16
16
- encapsulate_message ( destination, LOOP_COVER_MESSAGE_PAYLOAD . to_vec ( ) , topology)
17
+ encapsulate_message (
18
+ destination,
19
+ LOOP_COVER_MESSAGE_PAYLOAD . to_vec ( ) ,
20
+ topology,
21
+ LOOP_COVER_MESSAGE_AVERAGE_DELAY ,
22
+ )
17
23
}
18
24
19
25
pub fn encapsulate_message < T : NymTopology > (
20
26
recipient : Destination ,
21
27
message : Vec < u8 > ,
22
28
topology : & T ,
29
+ average_delay : f64 ,
23
30
) -> ( SocketAddr , SphinxPacket ) {
24
31
let mut providers = topology. get_mix_provider_nodes ( ) ;
25
32
let provider = providers. pop ( ) . unwrap ( ) . into ( ) ;
26
33
27
34
let route = topology. route_to ( provider) . unwrap ( ) ;
28
35
29
- // Set average packet delay to an arbitrary but at least not super-slow value for testing.
30
- let average_delay = 0.1 ;
31
36
let delays = sphinx:: header:: delays:: generate ( route. len ( ) , average_delay) ;
32
37
33
38
// build the packet
0 commit comments