[spam][crazy][fiction][random] Non-Canon MCBoss Spinoffs
Undescribed Horrific Abuse, One Victim & Survivor of Many
gmkarl at gmail.com
Mon Nov 13 05:33:57 PST 2023
These are the bandaids I am using to run gaiad over a socks proxy such as tor.
Use like:
$ all_proxy=socks5h://127.0.0.1:9050 gaiad start
I also tweaked config.toml to reduce the peers and increase the timeouts.
p2p/netaddress.go: add socks support
p2p/transport.go: remove checks for duplicate remote ips
blockchain/v0/pool.go: reduce block queue size and increase timeout
Users could find it useful to further adjust the values in
blockchain/v0/pool.go to impact syncing bandwidth and stability.
Making changes like these to blockchain/v0/pool.go can provide for running a
node on a very slow link which previously was prevented. See
https://github.com/cometbft/cometbft/issues/1595
diff --git a/p2p/netaddress.go b/p2p/netaddress.go
index b8e0c2419..329e21bef 100644
--- a/p2p/netaddress.go
+++ b/p2p/netaddress.go
@@ -5,6 +5,7 @@
package p2p
import (
+ "context"
"encoding/hex"
"errors"
"flag"
@@ -15,6 +16,7 @@ import (
"time"
tmp2p "github.com/tendermint/tendermint/proto/tendermint/p2p"
+ "golang.org/x/net/proxy"
)
// EmptyNetAddress defines the string representation of an empty NetAddress
@@ -231,18 +233,24 @@ func (na *NetAddress) DialString() string {
)
}
-// Dial calls net.Dial on the address.
+// Dial calls proxy.Dial on the address.
func (na *NetAddress) Dial() (net.Conn, error) {
- conn, err := net.Dial("tcp", na.DialString())
+ ctx := context.Background()
+ conn, err := proxy.Dial(ctx, "tcp", na.DialString())
+ //conn, err := net.Dial("tcp", na.DialString())
if err != nil {
return nil, err
}
return conn, nil
}
-// DialTimeout calls net.DialTimeout on the address.
+// DialTimeout calls proxyDial on the address with a timeout context.
func (na *NetAddress) DialTimeout(timeout time.Duration) (net.Conn, error) {
- conn, err := net.DialTimeout("tcp", na.DialString(), timeout)
+ ctx, cancel := context.WithTimeout(context.Background(), timeout)
+ defer cancel()
+ //ctx := context.Background()
+ conn, err := proxy.Dial(ctx, "tcp", na.DialString())
+ //conn, err := net.DialTimeout("tcp", na.DialString(), timeout)
if err != nil {
return nil, err
}
diff --git a/p2p/transport.go b/p2p/transport.go
index 416c94694..f237f3ea0 100644
--- a/p2p/transport.go
+++ b/p2p/transport.go
@@ -90,11 +90,11 @@ func ConnDuplicateIPFilter() ConnFilterFunc {
return func(cs ConnSet, c net.Conn, ips []net.IP) error {
for _, ip := range ips {
if cs.HasIP(ip) {
- return ErrRejected{
- conn: c,
- err: fmt.Errorf("ip<%v> already connected", ip),
- isDuplicate: true,
- }
+ return nil//ErrRejected{ // proxied connections all trigger this
from the proxy's ip
+ // conn: c,
+ // err: fmt.Errorf("ip<%v> already connected", ip),
+ // isDuplicate: true,
+ //}
}
}
@@ -367,9 +367,9 @@ func (mt *MultiplexTransport) filterConn(c
net.Conn) (err error) {
}()
// Reject if connection is already present.
- if mt.conns.Has(c) {
- return ErrRejected{conn: c, isDuplicate: true}
- }
+ //if mt.conns.Has(c) {
+ // return ErrRejected{conn: c, isDuplicate: true}
+ //}
// Resolve ips for incoming conn.
ips, err := resolveIPs(mt.resolver, c)
diff --git a/blockchain/v0/pool.go b/blockchain/v0/pool.go
index b3a09b1dc..d8f066698 100644
--- a/blockchain/v0/pool.go
+++ b/blockchain/v0/pool.go
@@ -29,10 +29,10 @@ eg, L = latency = 0.1s
const (
requestIntervalMS = 2
- maxTotalRequesters = 600
+ maxTotalRequesters = 6 // 600
maxPendingRequests = maxTotalRequesters
maxPendingRequestsPerPeer = 20
- requestRetrySeconds = 30
+ requestRetrySeconds = 30000 // 30 // retrying wipes the
request information which makes it think a delayed block is from an
invalid peer
// Minimum recv rate to ensure we're receiving blocks from a peer fast
// enough. If a peer is not sending us data at at least that rate, we
@@ -40,13 +40,13 @@ const (
//
// Assuming a DSL connection (not a good choice) 128 Kbps (upload) ~ 15 KB/s,
// sending data across atlantic ~ 7.5 KB/s.
- minRecvRate = 7680
+ minRecvRate = 768 // 7680
// Maximum difference between current and new block's height.
maxDiffBetweenCurrentAndReceivedBlockHeight = 100
)
-var peerTimeout = 15 * time.Second // not const so we can override with tests
+var peerTimeout = 150 * time.Second // 15 * time.Second // not const
so we can override with tests
/*
Peers self report their heights when we join the block pool.
More information about the cypherpunks
mailing list