Comments (8)
One thing to bear in bind is APAF and OONI are using this method, AFAIK, so we should keep backwards compatibility ideally for their use-cases (the above looks fine for that).
Also instead of isinstance() it's probably more consistent with Twisted to check if the object implements the correct interface, like "if zope.interface.implements(connection, IStreamClientEndpoint): IStreamClientEndpoint(connection).connect(TorProtocolFactory())". I just made that syntax up for the idea :)
from txtorcon.
...but yes, I like this! Will make the examples more concise.
from txtorcon.
I've created a new branch buildtorconnection that changes build_tor_connection() and adds a build_local_tor_connection(). I've changed examples/attach_stream_by_country to use the new function (most of the changes in the example are again pep8 and one bug :-)).
The documentation in torstate was not changed yet.
Should the APAF- and OONI-people have a brief look on that? All the unittests continue to work unchanged and as long as build_tor_connection is not used with keyword-arguments, they are fine.
from txtorcon.
Yes, it's actually checking IStreamClientEndpoint.providedBy() which should be fine.
Also notice that build_local_tor_connection() can be supplied with a password-argument and such which pass through **kwargs.
from txtorcon.
Should built_tor_connection and build_local_tor_connection return a reference to the endpoint that might have been created?
endpoint, d = build_local_tor_connection()
# and
_, d = build_tor_connection(endpoint)
endpoint, d = build_tor_connection(('localhost', 9051))
from txtorcon.
I'd say probably not; any code that wants this can get it from "protocol.transport.addr" (or state.protocol.transport.addr)
from txtorcon.
closed?
from txtorcon.
Thanks for the patch, and closing these.
from txtorcon.
Related Issues (20)
- attribute-error on python 3.9
- All of test.test_util is skipped HOT 1
- All of test.test_web skipped
- Many tests in test.test_endpoints.EndpointTests fail when calling `_tor_launcher` with incompatible arguments
- Hosting onion service log says .onion twice
- Three tests errors (test_attribute_access, test_other_bootstrap, and ProtocolIntegrationTests.test_with_arg) HOT 3
- v2 onion in repo metadata HOT 1
- update CI
- use unittest.mock instead of mock HOT 3
- Unable to install txsocksx with python 3 HOT 1
- There is a lingering ipaddress dependency declaration HOT 1
- 1 test fails: AttributeError: [...] does not have the attribute 'pwd'
- twisted.web Agent created by txtorcon should accept other Agent options
- Add support for Python 3.10 and 3.11
- Three unit tests are failing on Python 3.12
- When tor process exits unexpectedly tor.protocol.get_info hangs HOT 5
- Handle limits better HOT 1
- debian sid bug: 1060955
- cant gpg verefy 23.11.0 HOT 6
- Drop or declare dependency on six HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from txtorcon.