p2p connections from outside

Totalitatea subiectelor care nu respectă regulamentul impus in sectiunea "Probleme şi Întrebări" vor fi stocate aici.
Avatar utilizator
Davey
Membru Club

Membru Club
Mesaje: 511
Membru din: 07 Iul 2014, 13:07
Regat: Jinno
Aprecieri: 143  
Mulţumiri: 50  
Medalii

Bebi scrie: ↑14 Mai 2020, 19:00Ai sursa ?
Am am :D
“I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.”

― Marilyn Monroe
Afișează semnătura
Avatar utilizator
Bebi
Nivel 2

Nivel 2
Mesaje: 265
Membru din: 14 Feb 2016, 22:37
Server: Metin2Rienergy
Regat: Chunjo
Aprecieri: 145  
Mulţumiri: 16  
 Contact:
Medalii

desc_p2p.cpp :
#include "stdafx.h"
#include "desc_p2p.h"
#include "protocol.h"
#include "p2p.h"
#include "../../common/CommonDefines.h"

DESC_P2P::~DESC_P2P()
{
}

void DESC_P2P::Destroy()
{
if (m_sock == INVALID_SOCKET) {
return;
}

P2P_MANAGER::instance().UnregisterAcceptor(this);

fdwatch_del_fd(m_lpFdw, m_sock);

sys_log(0, "SYSTEM: closing p2p socket. DESC #%d", m_sock);

socket_close(m_sock);
m_sock = INVALID_SOCKET;

// Chain up to base class Destroy()
DESC::Destroy();
}

#ifdef ENABLE_PORT_SECURITY
#include "config.h"
#endif
bool DESC_P2P::Setup(LPFDWATCH fdw, socket_t fd, const char * host, WORD wPort)
{
m_lpFdw = fdw;
m_stHost = host;
m_wPort = wPort;
m_sock = fd;

if (!(m_lpOutputBuffer = buffer_new(1024 * 1024)))
return false;

if (!(m_lpInputBuffer = buffer_new(1024 * 1024)))
return false;

fdwatch_add_fd(m_lpFdw, m_sock, this, FDW_READ, false);

m_iMinInputBufferLen = 1024 * 1024;
#ifdef ENABLE_PORT_SECURITY
if (strcmp(host, g_szPublicIP)) // refuse if remote host != public ip (only the same machine must be able to connect in here)
{
sys_log(0, "SYSTEM: new p2p connection from [%s] to [%s] fd: %d BLOCKED", host, g_szPublicIP, m_sock);
SetPhase(PHASE_CLOSE);
return true;
}
#endif
SetPhase(PHASE_P2P);

sys_log(0, "SYSTEM: new p2p connection from [%s] fd: %d", host, m_sock);
return true;
}

void DESC_P2P::SetPhase(int iPhase)
{
static CInputP2P s_inputP2P;

switch (iPhase)
{
case PHASE_P2P:
sys_log(1, "PHASE_P2P");

if (m_lpInputBuffer)
buffer_reset(m_lpInputBuffer);

if (m_lpOutputBuffer)
buffer_reset(m_lpOutputBuffer);

m_pInputProcessor = &s_inputP2P;
break;

case PHASE_CLOSE:
m_pInputProcessor = NULL;
break;

default:
sys_err("DESC_P2P::SetPhase : Unknown phase");
break;
}

m_iPhase = iPhase;
}
Imagine
Afișează semnătura
Avatar utilizator
Davey
Membru Club

Membru Club
Mesaje: 511
Membru din: 07 Iul 2014, 13:07
Regat: Jinno
Aprecieri: 143  
Mulţumiri: 50  
Medalii

Bebi scrie: ↑14 Mai 2020, 20:29 desc_p2p.cpp :
#include "stdafx.h"
#include "desc_p2p.h"
#include "protocol.h"
#include "p2p.h"
#include "../../common/CommonDefines.h"

DESC_P2P::~DESC_P2P()
{
}

void DESC_P2P::Destroy()
{
if (m_sock == INVALID_SOCKET) {
return;
}

P2P_MANAGER::instance().UnregisterAcceptor(this);

fdwatch_del_fd(m_lpFdw, m_sock);

sys_log(0, "SYSTEM: closing p2p socket. DESC #%d", m_sock);

socket_close(m_sock);
m_sock = INVALID_SOCKET;

// Chain up to base class Destroy()
DESC::Destroy();
}

#ifdef ENABLE_PORT_SECURITY
#include "config.h"
#endif
bool DESC_P2P::Setup(LPFDWATCH fdw, socket_t fd, const char * host, WORD wPort)
{
m_lpFdw = fdw;
m_stHost = host;
m_wPort = wPort;
m_sock = fd;

if (!(m_lpOutputBuffer = buffer_new(1024 * 1024)))
return false;

if (!(m_lpInputBuffer = buffer_new(1024 * 1024)))
return false;

fdwatch_add_fd(m_lpFdw, m_sock, this, FDW_READ, false);

m_iMinInputBufferLen = 1024 * 1024;
#ifdef ENABLE_PORT_SECURITY
if (strcmp(host, g_szPublicIP)) // refuse if remote host != public ip (only the same machine must be able to connect in here)
{
sys_log(0, "SYSTEM: new p2p connection from [%s] to [%s] fd: %d BLOCKED", host, g_szPublicIP, m_sock);
SetPhase(PHASE_CLOSE);
return true;
}
#endif
SetPhase(PHASE_P2P);

sys_log(0, "SYSTEM: new p2p connection from [%s] fd: %d", host, m_sock);
return true;
}

void DESC_P2P::SetPhase(int iPhase)
{
static CInputP2P s_inputP2P;

switch (iPhase)
{
case PHASE_P2P:
sys_log(1, "PHASE_P2P");

if (m_lpInputBuffer)
buffer_reset(m_lpInputBuffer);

if (m_lpOutputBuffer)
buffer_reset(m_lpOutputBuffer);

m_pInputProcessor = &s_inputP2P;
break;

case PHASE_CLOSE:
m_pInputProcessor = NULL;
break;

default:
sys_err("DESC_P2P::SetPhase : Unknown phase");
break;
}

m_iPhase = iPhase;
}
Asta e rezolvarea? Trebuie sa caut in Sursa game?
“I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.”

― Marilyn Monroe
Afișează semnătura
Avatar utilizator
Bebi
Nivel 2

Nivel 2
Mesaje: 265
Membru din: 14 Feb 2016, 22:37
Server: Metin2Rienergy
Regat: Chunjo
Aprecieri: 145  
Mulţumiri: 16  
 Contact:
Medalii

Inlocuieste desc_p2p.cpp de la tine din sursa game, compileaza o la loc si gata, cum a spus si cr3zy tie acum iti accepta ip uri externe, daca pui ce ti am dat eu o sa ai doar acces din intern la portul p2p adica cel pe care ti se conecteaza "hackerii" si iti cer 100E pentru "protectie". Pune ce ti am dat eu si revino cu edit.
Imagine
Afișează semnătura
Avatar utilizator
Davey
Membru Club

Membru Club
Mesaje: 511
Membru din: 07 Iul 2014, 13:07
Regat: Jinno
Aprecieri: 143  
Mulţumiri: 50  
Medalii

Bebi scrie: ↑14 Mai 2020, 21:43 Inlocuieste desc_p2p.cpp de la tine din sursa game, compileaza o la loc si gata, cum a spus si cr3zy tie acum iti accepta ip uri externe, daca pui ce ti am dat eu o sa ai doar acces din intern la portul p2p adica cel pe care ti se conecteaza "hackerii" si iti cer 100E pentru "protectie". Pune ce ti am dat eu si revino cu edit.
Nu mi-l poti pune si cu taburi te rog mult?
“I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.”

― Marilyn Monroe
Afișează semnătura
Avatar utilizator
Bebi
Nivel 2

Nivel 2
Mesaje: 265
Membru din: 14 Feb 2016, 22:37
Server: Metin2Rienergy
Regat: Chunjo
Aprecieri: 145  
Mulţumiri: 16  
 Contact:
Medalii

Imagine
Afișează semnătura
Avatar utilizator
Davey
Membru Club

Membru Club
Mesaje: 511
Membru din: 07 Iul 2014, 13:07
Regat: Jinno
Aprecieri: 143  
Mulţumiri: 50  
Medalii

desc_p2p.cpp:5:40: error: ../../common/CommonDefines.h: No such file or directory
eroare la compilare
“I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.”

― Marilyn Monroe
Afișează semnătura
Avatar utilizator
Bebi
Nivel 2

Nivel 2
Mesaje: 265
Membru din: 14 Feb 2016, 22:37
Server: Metin2Rienergy
Regat: Chunjo
Aprecieri: 145  
Mulţumiri: 16  
 Contact:
Medalii

https://github.com/janisozaur/ro/blob/m ... nDefines.h

Il pui in common din folderul de la sursa
Imagine
Afișează semnătura
Avatar utilizator
Davey
Membru Club

Membru Club
Mesaje: 511
Membru din: 07 Iul 2014, 13:07
Regat: Jinno
Aprecieri: 143  
Mulţumiri: 50  
Medalii

Bebi scrie: ↑15 Mai 2020, 18:43 https://github.com/janisozaur/ro/blob/m ... nDefines.h

Il pui in common din folderul de la sursa
../../common/CommonDefines.h:8:37: error: missing binary operator before token "("
../../common/CommonDefines.h:25:6: warning: #warning this qt version is outdated
“I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.”

― Marilyn Monroe
Afișează semnătura
Avatar utilizator
Davey
Membru Club

Membru Club
Mesaje: 511
Membru din: 07 Iul 2014, 13:07
Regat: Jinno
Aprecieri: 143  
Mulţumiri: 50  
Medalii

UP

[ Postat de pe iPhone ] Imagine
“I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.”

― Marilyn Monroe
Afișează semnătura
Închis

Înapoi la “Arhivă Probleme şi Întrebări”

  • Informaţie
  • Cine este conectat

    Utilizatori ce ce navighează pe acest forum: Bing [Bot], Google [Bot] și 125 vizitatori