@@ -14,26 +14,30 @@ struct Cli {
14
14
help = "name of the interface, use `auto` to determine automatically"
15
15
) ]
16
16
interface : Option < String > ,
17
+
17
18
#[ arg(
18
19
long,
19
20
help = "if `interface` is set, the packets will be written to the `pcap` file, \
20
21
otherwise the file will be a source of packets"
21
22
) ]
22
23
path : PathBuf ,
23
24
25
+ #[ arg( long, help = "bpf filter, example: \" udp and not port 443\" " ) ]
26
+ filter : Option < String > ,
27
+
24
28
/// Peer secret key
25
29
#[ arg( long, short = 's' , env = "OPENMINA_P2P_SEC_KEY" ) ]
26
- pub p2p_secret_key : Option < SecretKey > ,
30
+ p2p_secret_key : Option < SecretKey > ,
27
31
28
32
// warning, this overrides `OPENMINA_P2P_SEC_KEY`
29
33
/// Compatibility with OCaml Mina node
30
34
#[ arg( long) ]
31
- pub libp2p_keypair : Option < String > ,
35
+ libp2p_keypair : Option < String > ,
32
36
33
37
// warning, this overrides `OPENMINA_P2P_SEC_KEY`
34
38
/// Compatibility with OCaml Mina node
35
39
#[ arg( env = "MINA_LIBP2P_PASS" ) ]
36
- pub libp2p_password : Option < String > ,
40
+ libp2p_password : Option < String > ,
37
41
}
38
42
39
43
fn init_logger_std ( ) -> Box < dyn log:: Log > {
@@ -51,6 +55,7 @@ fn main() {
51
55
let Cli {
52
56
interface,
53
57
path,
58
+ filter,
54
59
p2p_secret_key,
55
60
libp2p_keypair,
56
61
libp2p_password,
@@ -106,7 +111,7 @@ fn main() {
106
111
let res = Ok ( ( ) ) . and_then ( |( ) | {
107
112
let mut capture = Capture :: from_device ( device) ?. open ( ) ?;
108
113
capture
109
- . filter ( "udp and not port 443" , true )
114
+ . filter ( & filter . unwrap_or_default ( ) , true )
110
115
. expect ( "Failed to apply filter" ) ;
111
116
let savefile = capture. savefile ( & path) ?;
112
117
0 commit comments