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

Adding proxies #424

Closed
monkeyden opened this issue Apr 25, 2024 · 11 comments
Closed

Adding proxies #424

monkeyden opened this issue Apr 25, 2024 · 11 comments

Comments

@monkeyden
Copy link

I'm going to take a stab at adding proxy support. Is it safe to start with master or should I use v0.34.0?

@michaelhly
Copy link
Owner

michaelhly commented Apr 25, 2024

Master is safe. But what do you mean by proxy?

@monkeyden
Copy link
Author

Requests are made through a rotating proxy service. Common method to get around overly stringent rate limits.

Solana mainnet allows 10 RPC calls per second. Each proxy IP is a multiplier of that.

@michaelhly
Copy link
Owner

Oh. Like fallback endpoints?

@monkeyden
Copy link
Author

In this case, the client is passing requests through a proxy, in order to mask the original source.

Let's use ProxyMesh as an example. Solana itself restricts RPC calls to 10 per second. Using ProxyMesh, I could use something like xxxx.proxymesh.com:1234, passing all my requests through a proxy first, and in turn have access to 10|20|50|100 distinct IPs making the requests for me.

Other crypto libraries, like ccxt, have something similar. Consider chart data. Binance does the most volume of any CEX, therefore its price data is the best better barometer for the market. If your country isn't served by Binance but you still want to make REST calls, you can either use a VPN or pass the requests through something like ProxyMesh.

Note: Not an endorsement of ProxyMesh. It just happens to be the service I'm looking at right now.

@michaelhly
Copy link
Owner

michaelhly commented Apr 26, 2024

I do not think that should be added to this library. Perhaps you can start your own package and wrap the Client or AsyncClient.

cc @kevinheavey, he may have thoughts.

@monkeyden
Copy link
Author

I can absolutely appreciate that perspective.

@kevinheavey
Copy link
Collaborator

Yeah agreed with @michaelhly. But do let us know if something about solana-py's design makes it unnecessarily difficult to add proxy support in a new library

@Jonney
Copy link
Contributor

Jonney commented Dec 11, 2024

I believe it is very necessary to add the feature of using a proxy because there are firewalls in this world, and using a proxy can bypass them.

What we need to do is add an argument in the init() and pass it to the httpx.Client(), very simple. I can make a PR if this modification is allowed.

@michaelhly
Copy link
Owner

I believe it is very necessary to add the feature of using a proxy because there are firewalls in this world, and using a proxy can bypass them.

What we need to do is add an argument in the init() and pass it to the httpx.Client(), very simple. I can make a PR if this modification is allowed.

Feel free! I can include it in the next release!

@Jonney
Copy link
Contributor

Jonney commented Dec 12, 2024

Here you go.
#479
@michaelhly

@michaelhly
Copy link
Owner

@Jonney Released in v0.36.1

🎉

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

No branches or pull requests

4 participants