Closed macpie closed 6 years ago
Thanks for the patch!
My only issue with the change is not not use the recommanded lifetime for nat_pmp. They say in the specification:
The RECOMMENDED Port Mapping Lifetime is 3600 seconds.
Also the doc says :
A client can request the explicit deletion of all its UDP or TCP mappings by sending the same deletion request to the NAT gateway with external port, internal port, and lifetime set to 0.
So I would rather keep the default there. Maybe the lease should be resent every X Lifetime automatically and the library provide such mechanism?
I think we could make the default for all 3600
as long as 0
does not mean delete. Then if a user try to do a delete all (which is only for pmp
I guess) he/she can use add_port_mapping(C, tcp, 0, 0, 0)
.
As for the tracking, it would required to transform nat
into an app, personally I have decided to do the tracking in my app (libp2p).
add_port_mapping
whenLifeTime
is 0.