Comments (2)
Currently the Gateway has following Version Header (sent as the initial handshake procedure):
type versionHeader struct {
Version build.ProtocolVersion
GenesisID types.BlockID
UniqueID gatewayID
WantConn bool
}
However I believe we may want to extend this to at least:
// IPv4/IPv6 /Onion Address
type NetAddress [16]byte
type versionHeader struct {
Version build.ProtocolVersion
GenesisID types.BlockID
UniqueID gatewayID
AddressFrom NetAddress
AddressTo NetAddress
WantConn bool
}
Whereby the AddressFrom is the most important one for this issue, as it would allow us to check which address the peer believes its from. This is especially important, as this way we would also be able to detect if it needs to be connected to via a proxy.
As part of a solution of this issue I would therefore want to propose that we from now on store and exchange all net addresses in IPv6 format:
- An IPv6 address remains unchanged, so nothing to do for that one;
- An IPv4 address is mapped to an IPv6 address, by simply prefixing it with zeroes (see: https://en.wikipedia.org/wiki/IPv6#IPv4-mapped_IPv6_addresses);
- An onion address can be mapped to IPv6 by prefixing it with a constant prefix, to turn them into a Unique Local IPv6 Unicast Address (as described in https://tools.ietf.org/html/rfc4193), I propose we simply use the
fd87:d87e:eb43::/48 IPv6 range
for this, as that network range is also used by Bitcoin, which on its turn took inspiration from OnionCat. Either way the specific range isn't too important, as long as we stick to it, based on the ideas described in RFC4193;
Using this new Version Handshake, we can then check the address from the other peer (AddressFrom
) and see if it has a specific prefix that indicates we want to interpret its address in a specific way, telling us perhaps also more about the type of connection we want to make.
This would allow other peers to run as a hidden service, and let us know they do so, by specifying their public key (onion address) as an IPv6 address (AddressFrom
). The receiver of this header would then remove the prefix, and use the lower 80 bits as the public key (as a public key is simply 80 bits of base32 encoded data AFAIK). Knowing that the other peer is run as a hidden service, this peer also has to make sure a Tor Proxy is running, dial that proxy, and dial the public key via that proxy (see: SOCKS5).
In theory we could make this Tor Proxy support optional, and any peers not Tor-enabled could simply block such incoming connections due to not supporting them.
If for some reason a peer is not aware of this Tor Network Address, it would simply think it's an IPv6 address, try to connect to it, and fail. No harm done. But I don't think there is any reason that any peer should ever get into this situation, even though it wouldn't be harmful.
On top of this proposal we would also want to add some extra CLI flags, which allows a user to make his rivined Tor-Enabled, and optionally run behind an hidden service itself. The hidden service can either be configured via the torrc configure file, or we can even support to create a ephemeral hidden service via tor's socket API (see: https://stem.torproject.org/api/control.html#stem.control.Controller.create_ephemeral_hidden_service).
from rivine.
@GlenDC Is a peer able to expose itself over both ipv4 and ipv6?
from rivine.
Related Issues (20)
- R&D explorer HA load balancing solution that works for all rivine-based chains HOT 15
- provide GraphQL explorer module for rivine (shorthand: q) HOT 20
- R&D if we can use storm to enhance our performance of Rivine's boltDB usage HOT 1
- R&D wallet module design and possible refactor HOT 1
- Stop block creators from knowingly creating blocks in the past HOT 4
- research dragonchain HOT 1
- Research how a rivine private key can be used in Stellar HOT 3
- better algorithm for output selection required HOT 12
- Front caddy proxy failover
- rivinecg generate blockchain fails HOT 4
- rivinecg: default generated client does not compile HOT 3
- travis no longer executes go tests HOT 1
- research cardano HOT 1
- Make rivine available as a go module
- review block structure HOT 2
- Implement a better reference output selection
- travis fails on the examples/rivchain job
- Convert rivine/research/stellar/examples to python HOT 2
- Convert rivine/research/stellar/examples to other javascript HOT 2
- authcoin extension by default authorized using the reverse property does not work HOT 1
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 rivine.