Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy improvements #374

Merged
merged 5 commits into from
Jan 21, 2024

Conversation

judsonjuniorr
Copy link
Contributor

Hello, I've conducted some tests using the new ProxyAgent() on the testProxy function when adding a new proxy (the same agent that is sent to Baileys). However, when using it, the IP did not change.

  • I changed it to use the HttpsProxyAgent, and when using it, it worked as expected.

  • I also changed the website to check the IP address from meuip.com.br to icanhazip.com. When using meuip.com.br, I encountered some errors due to Cloudflare protection. After changing the website, the error was resolved.
    cloudflare error

  • I extracted the proxy agent creation into a function that can be used anywhere, ensuring the use of the same agent for all instances.

  • Additionally, I added a validation to check if the instance exists before attempting to add a proxy to it.


I'm new to the PR process and included the code from this PR: #371 in this one. If you prefer it to be separate, please let me know, and I'll fork again to handle it correctly.

In some tests made on the testProxy function, the `new ProxyAgent()` was not working, even adding it the IP result was the same.

I've change it to the `new HttpsProxyAgent()` and it worked.

Refactored the proxy agent to center the same function/creation the same where it is used
@bergpinheiro
Copy link
Contributor

Que tipo de proxy devo usar? Onde comprar?

@judsonjuniorr
Copy link
Contributor Author

Que tipo de proxy devo usar? Onde comprar?

Fiz os testes usando o do proxy scrape eles tem um plano de $1 para 1Gb para testar o proxy

@bergpinheiro
Copy link
Contributor

Toda hora da esse erro:{"status":400,"error":"Bad Request","response":{"message":["Invalid proxy"]}}
Minha configuração:
{
"enabled": true,
"proxy": {
"host": "rp.proxyscrape.com", /* ex: 51.195.115.21 /
"port": "6060", /
ex: 8080 /
"protocol": "http", /
ex: http /
"username": "
", / ex: user (optional) /
"password": "
*" / ex: password (optional) */
}
}

no exemplro removi o user e senha

@judsonjuniorr
Copy link
Contributor Author

Quando tem proxyscrape no host a API tenta buscar a partir da lista pública gratuita de proxy, utiliza o IP no lugar o hostname

@bergpinheiro
Copy link
Contributor

Quando tem proxyscrape no host a API tenta buscar a partir da lista pública gratuita de proxy, utiliza o IP no lugar o hostname

entao nao tem como testar?

@DavidsonGomes DavidsonGomes merged commit 9d685da into EvolutionAPI:develop Jan 21, 2024
@judsonjuniorr
Copy link
Contributor Author

Quando tem proxyscrape no host a API tenta buscar a partir da lista pública gratuita de proxy, utiliza o IP no lugar o hostname

entao nao tem como testar?

Tem sim, no proxyscrape tem a opção de obter o IP no lugar do hostname, ai só trocar lá no painel

@bergpinheiro
Copy link
Contributor

Conseguir configurar. So find ta voltando ok. Tem como saber se ta funcionando com o ip do proxy?

@judsonjuniorr
Copy link
Contributor Author

@lindenbergp depois que configurar você pode acompanhar o uso pelo painel do proxy, se tiver contabilizando o uso quer dizer que ta funcionando

@judsonjuniorr judsonjuniorr deleted the proxy-improvements branch January 22, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants