mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-27 07:47:03 -05:00
basics for TOR proxy status. Unfinished
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7567 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
65d2249bf4
commit
03fc766e55
@ -134,6 +134,8 @@ p3PeerMgrIMPL::p3PeerMgrIMPL(const RsPeerId& ssl_own_id, const RsPgpId& gpg_own_
|
||||
kConfigDefaultProxyServerIpAddr.c_str());
|
||||
sockaddr_storage_ipv4_setport(mProxyServerAddress,
|
||||
kConfigDefaultProxyServerPort);
|
||||
|
||||
mProxyServerStatus = RS_NET_PROXY_STATUS_UNKNOWN ;
|
||||
}
|
||||
|
||||
#ifdef PEER_DEBUG
|
||||
@ -215,12 +217,12 @@ bool p3PeerMgrIMPL::setOwnNetworkMode(uint32_t netMode)
|
||||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
//#ifdef PEER_DEBUG
|
||||
#ifdef PEER_DEBUG
|
||||
std::cerr << "p3PeerMgrIMPL::setOwnNetworkMode() :";
|
||||
std::cerr << " Existing netMode: " << mOwnState.netMode;
|
||||
std::cerr << " Input netMode: " << netMode;
|
||||
std::cerr << std::endl;
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
if (mOwnState.netMode != (netMode & RS_NET_MODE_ACTUAL))
|
||||
{
|
||||
@ -441,7 +443,13 @@ bool p3PeerMgrIMPL::setProxyServerAddress(const struct sockaddr_storage &proxy_a
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3PeerMgrIMPL::getProxyServerStatus(uint32_t& proxy_status)
|
||||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
proxy_status = mProxyServerStatus;
|
||||
return true;
|
||||
}
|
||||
bool p3PeerMgrIMPL::getProxyServerAddress(struct sockaddr_storage &proxy_addr)
|
||||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
@ -184,6 +184,7 @@ virtual uint32_t getConnectionType(const RsPeerId &sslId) = 0;
|
||||
|
||||
virtual bool setProxyServerAddress(const struct sockaddr_storage &proxy_addr) = 0;
|
||||
virtual bool getProxyServerAddress(struct sockaddr_storage &proxy_addr) = 0;
|
||||
virtual bool getProxyServerStatus(uint32_t& status) = 0;
|
||||
virtual bool isHidden() = 0;
|
||||
virtual bool isHiddenPeer(const RsPeerId &ssl_id) = 0;
|
||||
virtual bool getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port) = 0;
|
||||
@ -284,6 +285,7 @@ virtual uint32_t getConnectionType(const RsPeerId& sslId);
|
||||
|
||||
virtual bool setProxyServerAddress(const struct sockaddr_storage &proxy_addr);
|
||||
virtual bool getProxyServerAddress(struct sockaddr_storage &proxy_addr);
|
||||
virtual bool getProxyServerStatus(uint32_t &proxy_status);
|
||||
virtual bool isHidden();
|
||||
virtual bool isHiddenPeer(const RsPeerId& ssl_id);
|
||||
virtual bool getProxyAddress(const RsPeerId& ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port);
|
||||
@ -364,6 +366,7 @@ private:
|
||||
std::map<RsPgpId, ServicePermissionFlags> mFriendsPermissionFlags ; // permission flags for each gpg key
|
||||
|
||||
struct sockaddr_storage mProxyServerAddress;
|
||||
uint32_t mProxyServerStatus ;
|
||||
};
|
||||
|
||||
#endif // MRK_PQI_PEER_MANAGER_HEADER
|
||||
|
@ -159,6 +159,11 @@ const uint32_t RS_NET_CONN_TYPE_FRIEND = 0x02000000;
|
||||
const uint32_t RS_NET_CONN_TYPE_SERVER = 0x04000000;
|
||||
const uint32_t RS_NET_CONN_TYPE_CLIENT = 0x08000000;
|
||||
|
||||
// working state of proxy
|
||||
|
||||
const uint32_t RS_NET_PROXY_STATUS_UNKNOWN = 0x0000 ;
|
||||
const uint32_t RS_NET_PROXY_STATUS_OK = 0x0001 ;
|
||||
|
||||
// Potential certificate parsing errors.
|
||||
|
||||
|
||||
@ -340,7 +345,7 @@ class RsPeers
|
||||
virtual bool setNetworkMode(const RsPeerId &ssl_id, uint32_t netMode) = 0;
|
||||
virtual bool setVisState(const RsPeerId &ssl_id, uint16_t vs_disc, uint16_t vs_dht) = 0;
|
||||
|
||||
virtual bool getProxyServer(std::string &addr, uint16_t &port) = 0;
|
||||
virtual bool getProxyServer(std::string &addr, uint16_t &port,uint32_t& status_flags) = 0;
|
||||
virtual bool setProxyServer(const std::string &addr, const uint16_t port) = 0;
|
||||
|
||||
virtual void getIPServersList(std::list<std::string>& ip_servers) = 0;
|
||||
|
@ -903,7 +903,7 @@ bool p3Peers::setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_t vs_dht)
|
||||
return mPeerMgr->setVisState(id, vs_disc, vs_dht);
|
||||
}
|
||||
|
||||
bool p3Peers::getProxyServer(std::string &addr, uint16_t &port)
|
||||
bool p3Peers::getProxyServer(std::string &addr, uint16_t &port, uint32_t &status)
|
||||
{
|
||||
std::cerr << "p3Peers::getProxyServer()" << std::endl;
|
||||
|
||||
@ -911,6 +911,7 @@ bool p3Peers::getProxyServer(std::string &addr, uint16_t &port)
|
||||
mPeerMgr->getProxyServerAddress(proxy_addr);
|
||||
addr = sockaddr_storage_iptostring(proxy_addr);
|
||||
port = sockaddr_storage_port(proxy_addr);
|
||||
mPeerMgr->getProxyServerStatus(status);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ virtual bool setDynDNS(const RsPeerId &id, const std::string &dyndns);
|
||||
virtual bool setNetworkMode(const RsPeerId &id, uint32_t netMode);
|
||||
virtual bool setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_t vs_dht);
|
||||
|
||||
virtual bool getProxyServer(std::string &addr, uint16_t &port);
|
||||
virtual bool getProxyServer(std::string &addr, uint16_t &port,uint32_t& status);
|
||||
virtual bool setProxyServer(const std::string &addr, const uint16_t port);
|
||||
|
||||
virtual void getIPServersList(std::list<std::string>& ip_servers) ;
|
||||
|
Loading…
x
Reference in New Issue
Block a user