ccding / go-stun

A go implementation of the STUN client (RFC 3489 and RFC 5389)
Apache License 2.0
663 stars 120 forks source link

Add keepalive method #14

Closed AudriusButkevicius closed 8 years ago

ccding commented 8 years ago

I don't understand why we need to keep alive for UDP listening.

AudriusButkevicius commented 8 years ago

It's to make sure that the mapping on the router is not lost.

AudriusButkevicius commented 8 years ago

replaced fmt with errors, yet fmt just calls errors

AudriusButkevicius commented 8 years ago

From RFC 5389:

It can
   also be used to check connectivity between two endpoints, and as a
   keep-alive protocol to maintain NAT bindings

...

It also provides a way for an endpoint to keep a NAT binding
   alive.

...

 When used in either request/
   response or in indication transactions, the Binding method can also
   be used to keep these "bindings" alive.