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 Instructions On How to Use #1

Open
ghost opened this issue May 9, 2017 · 9 comments
Open

Add Instructions On How to Use #1

ghost opened this issue May 9, 2017 · 9 comments

Comments

@ghost
Copy link

ghost commented May 9, 2017

I would like to kindly request you to explain us in a few words how we can use this. Thanks !

@cpacia
Copy link
Member

cpacia commented May 28, 2017

Everything is in openbazaard.go if you want to take a look https://github.com/OpenBazaar/openbazaar-go/blob/master/openbazaard.go

Roughly it's:

  • create the transport
auth := &proxy.Auth{Password: torConfig.Password}
onionTransport, err = torOnion.NewOnionTransport("tcp4", torControl, auth, repoPath)
if err != nil {
        log.Error(err)
	return err
}
  • add a new supported transport
addrutil.SupportedTransportStrings = append(addrutil.SupportedTransportStrings, "/onion")
t, err := ma.ProtocolsWithString("/onion")
if err != nil {
	log.Error(err)
	return err
}
addrutil.SupportedTransportProtocols = append(addrutil.SupportedTransportProtocols, t)
if err != nil {
	log.Error(err)
	return err
}
  • Add the transport. This goes inside the defaultHostOption function:
network.Swarm().AddTransport(onionTransport)
  • Also make sure to listen on the onion multiaddr

@bigs
Copy link
Contributor

bigs commented May 23, 2018

Hopping back on this thread... I just did some work with this library for a little demo project of libp2p and found I had to do quite a bit of spelunking through the OpenBazaar codebase to get it working as expected. I'd be happy to contribute some abbreviated docs if that's of interest!

@cretz
Copy link

cretz commented May 23, 2018

While we're hopping on this thread, I wrote https://github.com/cretz/bine which may be a bit easier to use and it supports statically compiled Tor.

@bigs
Copy link
Contributor

bigs commented May 23, 2018

@cretz That looks lovely! Would you have any interest in implementing a libp2p Transport?

Edit: Keeping in mind that this interface will shift a bit soon!

@cretz
Copy link

cretz commented May 23, 2018

@bigs - Not particularly tbh. But it looks like tor.Tor almost implements it already so the work isn't hard. I figure since the iface is about to change soon it can probably wait. Also, someone should update https://github.com/multiformats/multiaddr because there are two types of onion addresses (v2 and v3) having different lengths. It's fine if it's still /onion but it can be two sizes.

@cpacia
Copy link
Member

cpacia commented May 23, 2018

@cretz so your lib compiles and installs the tor binary?

@cretz
Copy link

cretz commented May 23, 2018

@cpacia - Not really. You can either point it to a Tor binary, or use https://github.com/cretz/tor-static + https://godoc.org/github.com/cretz/bine/process/embedded which
is just CGo wrapper around https://github.com/torproject/tor/blob/7fb941e9f26a1ae6b6faccea9a3e9620b8d90ef3/src/or/tor_api.h to statically link it inside the same binary as your Go app (adds about 20MB on WIndows).

@cpacia
Copy link
Member

cpacia commented May 24, 2018

Interesting. Have you tried using this on tails/whonix at all? One of the issues we've had with those OSs is their tor daemon is locked down and we can't easily communicate with it. I wonder if did this inside the Go binary if it would run with no issue on those OSs.

@cretz
Copy link

cretz commented May 24, 2018

Have you tried using this on tails/whonix at all?

I have not.

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

3 participants