document autorelay
License: MIT Signed-off-by: vyzo <vyzo@hackzen.org>
vyzo committed
Dec 13, 2018 at 10:19 UTC
526d6198a6c96ae0105c0f1ccde0d33ce47c3280
2 files changed
+47
-5
docs/config.md
+16
-5
@@ -149,11 +149,11 @@ A boolean value. If set to true, all block reads from disk will be hashed and
149
verified. This will cause increased CPU utilization.
150
151
- `BloomFilterSize`
152
-A number representing the size in bytes of the blockstore's [bloom filter](https://en.wikipedia.org/wiki/Bloom_filter). A value of zero represents the feature being disabled.
152
+A number representing the size in bytes of the blockstore's [bloom filter](https://en.wikipedia.org/wiki/Bloom_filter). A value of zero represents the feature being disabled.
153
154
-This site generates useful graphs for various bloom filter values: <https://hur.st/bloomfilter/?n=1e6&p=0.01&m=&k=7>
155
-You may use it to find a preferred optimal value, where `m` is `BloomFilterSize` in bits. Remember to convert the value `m` from bits, into bytes for use as `BloomFilterSize` in the config file.
156
-For example, for 1,000,000 blocks, expecting a 1% false positive rate, you'd end up with a filter size of 9592955 bits, so for `BloomFilterSize` we'd want to use 1199120 bytes.
154
+This site generates useful graphs for various bloom filter values: <https://hur.st/bloomfilter/?n=1e6&p=0.01&m=&k=7>
155
+You may use it to find a preferred optimal value, where `m` is `BloomFilterSize` in bits. Remember to convert the value `m` from bits, into bytes for use as `BloomFilterSize` in the config file.
156
+For example, for 1,000,000 blocks, expecting a 1% false positive rate, you'd end up with a filter size of 9592955 bits, so for `BloomFilterSize` we'd want to use 1199120 bytes.
157
As of writing, [7 hash functions](https://github.com/ipfs/go-ipfs-blockstore/blob/547442836ade055cc114b562a3cc193d4e57c884/caching.go#L22) are used, so the constant `k` is 7 in the formula.
158
159
@@ -164,7 +164,7 @@ Spec defines the structure of the ipfs datastore. It is a composable structure,
164
165
This can be changed manually, however, if you make any changes that require a different on-disk structure, you will need to run the [ipfs-ds-convert tool](https://github.com/ipfs/ipfs-ds-convert) to migrate data into the new structures.
166
167
-For more information on possible values for this configuration option, see docs/datastores.md
167
+For more information on possible values for this configuration option, see docs/datastores.md
168
169
Default:
170
```
@@ -334,6 +334,17 @@ Disables the p2p-circuit relay transport.
334
Enables HOP relay for the node. If this is enabled, the node will act as
335
an intermediate (Hop Relay) node in relay circuits for connected peers.
336
337
+- `EnableAutoRelay`
338
+Enables automatic relay for this node.
339
+If the node is a HOP relay (`EnableRelayHop` is true) then it will advertise itself as a relay through the DHT.
340
+Otherwise, the node will test its own NAT situation (dialability) using passively discovered AutoNAT services.
341
+If the node is not publicly reachable, then it will seek HOP relays advertised through the DHT and override its public address(es) with relay addresses.
342
+
343
+- `EnableAutoNATService`
344
+Enables the AutoNAT service for this node.
345
+The service allows peers to discover their NAT situation by requesting dial backs to their public addresses.
346
+This should only be enabled on publicly reachable nodes.
347
+
348
### `ConnMgr`
349
350
The connection manager determines which and how many connections to keep and can be configured to keep.
docs/experimental-features.md
+31
@@ -27,6 +27,7 @@ the above issue.
27
- [Directory Sharding / HAMT](#directory-sharding-hamt)
28
- [IPNS PubSub](#ipns-pubsub)
29
- [QUIC](#quic)
30
+- [AutoRelay](#autorelay)
31
32
---
33
@@ -649,3 +650,33 @@ For listening on a QUIC address, add it the swarm addresses, e.g. `/ip4/0.0.0.0/
650
- [ ] Make sure QUIC connections work reliably
651
- [ ] Make sure QUIC connection offer equal or better performance than TCP connections on real world networks
652
- [ ] Finalize libp2p-TLS handshake spec.
653
+
654
+
655
+## AutoRelay
656
+
657
+### In Version
658
+
659
+0.4.19-dev
660
+
661
+### State
662
+
663
+Experimental, disabled by default.
664
+
665
+Automatically discovers relays and advertises relay addresses when the node is behind an impenetrable NAT.
666
+
667
+### How to enable
668
+
669
+Modify your ipfs config:
670
+
671
+```
672
+ipfs config --json Swarm.EnableAutoRelay true
673
+```
674
+
675
+Bootstrappers (and other public nodes) need to also enable the AutoNATService:
676
+```
677
+ipfs config --json Swarm.EnableAutoNATService true
678
+```
679
+
680
+### Road to being a real feature
681
+
682
+- [ ] needs testing