mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-29 08:37:36 -04:00
add some documentation to updstunner.h
This commit is contained in:
parent
1874241ddd
commit
4095d82a67
1 changed files with 16 additions and 4 deletions
|
@ -30,10 +30,10 @@
|
||||||
#include "util/rsthreads.h"
|
#include "util/rsthreads.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/* UdpStun.
|
/**
|
||||||
|
* @brief The TouStunPeer class
|
||||||
* Stuns peers to determine external addresses.
|
* Stuns peers to determine external addresses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class TouStunPeer
|
class TouStunPeer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -53,10 +53,15 @@ class TouStunPeer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// id for identification
|
||||||
std::string id;
|
std::string id;
|
||||||
|
/// remote address
|
||||||
struct sockaddr_in remote, eaddr;
|
struct sockaddr_in remote, eaddr;
|
||||||
|
/// true when a response was received in the past
|
||||||
bool response;
|
bool response;
|
||||||
|
/// used to rate limit STUN requests
|
||||||
rstime_t lastsend;
|
rstime_t lastsend;
|
||||||
|
/// fail counter for dead/bad peer detection (0 = good)
|
||||||
uint32_t failCount;
|
uint32_t failCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,6 +70,13 @@ class TouStunPeer
|
||||||
* #define UDPSTUN_ALLOW_LOCALNET 1
|
* #define UDPSTUN_ALLOW_LOCALNET 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The UdpStunner class
|
||||||
|
* The UDP stunner implements the STUN protocol to determin the NAT type (behind that RS is usually running).
|
||||||
|
* It maintains a list of DHT peers that are regulary contacted.
|
||||||
|
*
|
||||||
|
* The actual NAT type determination logic is located in void pqiNetStateBox::determineNetworkState()
|
||||||
|
*/
|
||||||
class UdpStunner: public UdpSubReceiver
|
class UdpStunner: public UdpSubReceiver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -123,7 +135,7 @@ bool locked_checkExternalAddress();
|
||||||
|
|
||||||
struct sockaddr_in eaddr; /* external addr */
|
struct sockaddr_in eaddr; /* external addr */
|
||||||
|
|
||||||
bool eaddrKnown;
|
bool eaddrKnown;
|
||||||
bool eaddrStable; /* if true then usable. if false -> Symmettric NAT */
|
bool eaddrStable; /* if true then usable. if false -> Symmettric NAT */
|
||||||
rstime_t eaddrTime;
|
rstime_t eaddrTime;
|
||||||
|
|
||||||
|
@ -144,7 +156,7 @@ bool locked_checkExternalAddress();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool mPassiveStunMode;
|
bool mPassiveStunMode;
|
||||||
uint32_t mTargetStunPeriod;
|
uint32_t mTargetStunPeriod;
|
||||||
double mSuccessRate;
|
double mSuccessRate;
|
||||||
|
|
||||||
bool mExclusiveMode; /* when this is switched on, the stunner stays silent (and extAddr is maintained) */
|
bool mExclusiveMode; /* when this is switched on, the stunner stays silent (and extAddr is maintained) */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue