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

NAT traversal support #1205

Open
0xmichalis opened this issue Jun 28, 2018 · 12 comments
Open

NAT traversal support #1205

0xmichalis opened this issue Jun 28, 2018 · 12 comments

Comments

@0xmichalis
Copy link
Contributor

I couldn't find an issue tracking NAT traversal so I am opening one.

Some discussion already captured in #636

@yeastplume
Copy link
Member

That's fine #636 was a bit meandering (hence closure) but okay with tracking this specifcally.

@yeastplume
Copy link
Member

Sorry, accidental close.

@bladedoyle
Copy link
Contributor

beaver-tooth
@beaver-tooth
07:46
for anyone else mining behind a router they dont know the admin password to, I was able to use this portmapper tool to port forward: https://github.com/kaklakariada/portmapper

@garyyu
Copy link
Contributor

garyyu commented Jul 24, 2018

I would help on this enhancement, but could anybody give some hints about where to start in Grin sources? since I'm not familiar with what are related codes in Grin.

According to history messages, We can use this crate: https://github.com/ustulation/p2p , and it provide some examples: https://github.com/ustulation/p2p/tree/master/examples

In Grin p2p, there're:

$ tree p2p
p2p
├── Cargo.toml
├── rustfmt.toml
├── src
│   ├── conn.rs
│   ├── handshake.rs
│   ├── lib.rs
│   ├── msg.rs
│   ├── peer.rs
│   ├── peers.rs
│   ├── protocol.rs
│   ├── serv.rs
│   ├── store.rs
│   └── types.rs
└── tests
    ├── enum_ser_deser.rs
    └── peer_handshake.rs

@ignopeverell
Copy link
Contributor

Client connections are initiated in serv.rs, look for the connect method. This inititates the TCP connection, runs through the handshake and if all goes well, starts the listening loop.

@garyyu
Copy link
Contributor

garyyu commented Aug 3, 2018

thanks, will try to look into that.

@rentenmark
Copy link
Contributor

The library that @garyyu mentioned I believe is related to maidsafe/crust which could be a better option. They have heavily tested NAT traversal within their community with "crust test events".

@ignopeverell
Copy link
Contributor

Could you look at what integrating it would look like, based on what we already have in the p2p crate? It's not immediate from their doc and their server example is quite a bit of code.

@hashmap
Copy link
Contributor

hashmap commented Nov 30, 2018

We took a look at crust and underlined https://github.com/ustulation/p2p but found it's not so easy to integrate it with grin p2p

@rentenmark
Copy link
Contributor

I found this thing https://github.com/sbstp/rust-igd last night. It would be straightforward to integrate into grin::p2p although not nearly as comprehensive as https://github.com/ustulation/p2p it would add value for some users. Essentially rust-igd allows us to ask the router to forward ports for our app on behalf of the user using the "internet gateway device" (IGD) API.

Should I go for an integration? This may be at odds with #2026 but I think it would be fine if we set the minor version in Cargo.toml

@hashmap
Copy link
Contributor

hashmap commented Dec 10, 2018

I'm pessimistic about UPNP but I may be out of sync with the real world. I'd test it, at least it could help home users.

@0xmichalis
Copy link
Contributor Author

I had posted this in #636 but I am reposting here for clarity:

Bitcoin abandoned uPNP and seem to be in favor of NAT-PMP/PCP support: bitcoin/bitcoin#11902

Also, I guess I2P is another way to avoid port forwarding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants