@@ -14,26 +14,30 @@ struct Cli {
1414 help = "name of the interface, use `auto` to determine automatically"
1515 ) ]
1616 interface : Option < String > ,
17+
1718 #[ arg(
1819 long,
1920 help = "if `interface` is set, the packets will be written to the `pcap` file, \
2021 otherwise the file will be a source of packets"
2122 ) ]
2223 path : PathBuf ,
2324
25+ #[ arg( long, help = "bpf filter, example: \" udp and not port 443\" " ) ]
26+ filter : Option < String > ,
27+
2428 /// Peer secret key
2529 #[ arg( long, short = 's' , env = "OPENMINA_P2P_SEC_KEY" ) ]
26- pub p2p_secret_key : Option < SecretKey > ,
30+ p2p_secret_key : Option < SecretKey > ,
2731
2832 // warning, this overrides `OPENMINA_P2P_SEC_KEY`
2933 /// Compatibility with OCaml Mina node
3034 #[ arg( long) ]
31- pub libp2p_keypair : Option < String > ,
35+ libp2p_keypair : Option < String > ,
3236
3337 // warning, this overrides `OPENMINA_P2P_SEC_KEY`
3438 /// Compatibility with OCaml Mina node
3539 #[ arg( env = "MINA_LIBP2P_PASS" ) ]
36- pub libp2p_password : Option < String > ,
40+ libp2p_password : Option < String > ,
3741}
3842
3943fn init_logger_std ( ) -> Box < dyn log:: Log > {
@@ -51,6 +55,7 @@ fn main() {
5155 let Cli {
5256 interface,
5357 path,
58+ filter,
5459 p2p_secret_key,
5560 libp2p_keypair,
5661 libp2p_password,
@@ -106,7 +111,7 @@ fn main() {
106111 let res = Ok ( ( ) ) . and_then ( |( ) | {
107112 let mut capture = Capture :: from_device ( device) ?. open ( ) ?;
108113 capture
109- . filter ( "udp and not port 443" , true )
114+ . filter ( & filter . unwrap_or_default ( ) , true )
110115 . expect ( "Failed to apply filter" ) ;
111116 let savefile = capture. savefile ( & path) ?;
112117
0 commit comments