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

Add tor-client support #15

Merged
merged 2 commits into from Oct 3, 2020

Conversation

Amperture
Copy link
Contributor

As it turns out, the python requests library supports using the TOR service as a proxy, and when using the service, it can reach out to .onion hidden services.

This PR gives the option to create a TOR client to reach out into BTCPayServer instances behind .onion hidden services, as long as Tor is already running on the client machine.

@JeffVandrewJr
Copy link
Collaborator

Interesting. What do you perceive as the use case here?

@Amperture
Copy link
Contributor Author

The use case is allowing for people who keep nodes on local hardware (ex. Raspiblitz, hack0, myNode) to expose their BTCPayServer instance to clearnet-based web stores and applications.

My personal example is a webapp I'm developing to integrate BTCPayServer with live video tipping apps like Streamlabs and Streamelements -- CoinJerk

@@ -144,6 +144,23 @@ def create_client(cls, code, host):
token = client.pair_client(code)
return BTCPayClient(host=host, pem=pem, tokens=token)

def create_tor_client(cls, code, host, proxy='socks5://127.0.0.1:9050'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should insert @classmethod before this method, no? Check out the create_client() method as an illustration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I thought I had done so. My mistake.

@NicolasDorier
Copy link
Member

ping @JeffVandrewJr is this pr ready?

@JeffVandrewJr
Copy link
Collaborator

@NicolasDorier I need to test on a machine with Tor running. I'll try to get that done this weekend.

@JeffVandrewJr JeffVandrewJr merged commit 1c695e1 into btcpayserver:master Oct 3, 2020
@JeffVandrewJr
Copy link
Collaborator

Merged, package created, and package has been uploaded to the PyPi repository as v1.3.0. Thanks @Amperture !

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.

None yet

3 participants