GithubHelp home page GithubHelp logo

Comments (8)

meejah avatar meejah commented on May 31, 2024

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.

meejah avatar meejah commented on May 31, 2024

...but yes, I like this! Will make the examples more concise.

from txtorcon.

lukaslueg avatar lukaslueg commented on May 31, 2024

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.

lukaslueg avatar lukaslueg commented on May 31, 2024

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.

lukaslueg avatar lukaslueg commented on May 31, 2024

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.

meejah avatar meejah commented on May 31, 2024

I'd say probably not; any code that wants this can get it from "protocol.transport.addr" (or state.protocol.transport.addr)

from txtorcon.

lukaslueg avatar lukaslueg commented on May 31, 2024

closed?

from txtorcon.

meejah avatar meejah commented on May 31, 2024

Thanks for the patch, and closing these.

from txtorcon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.