Commit Graph

2396 Commits

Author SHA1 Message Date
Juan Batiz-Benet
17da5ca74a handshake3: ressurect the message 2014-12-21 05:45:30 -08:00
Juan Batiz-Benet
e6412c8f8b secio: remove old debug statements 2014-12-21 05:45:30 -08:00
Juan Batiz-Benet
da734fa4c8 swarm: learned to use a ConnHandler 2014-12-21 05:45:30 -08:00
Juan Batiz-Benet
3a78669209 dht: protocol change
Send + Recv compressed multiaddrs (bytes). this makes
for much smaller addresses, as string addresses are
inflated for human readability. compare:

```
consider: "/ip4/192.168.10.10/tcp/13456"
string: 0x2f6970342f3139322e3136382e31302e31302f7463702f3133343536
packed: 0x04c0a80a0a063490
```
2014-12-21 05:45:30 -08:00
Juan Batiz-Benet
fccdf863e1 dht: three tests pass 2014-12-21 05:45:30 -08:00
Juan Batiz-Benet
0cdc2e0adf dht: split out online record verification
Online record verification -- meaning record verification
that might cause messages to other peers -- presents a
way to perform an attack on a dht node: forge a record and
make the node attempt to fetch the public key to verify.
This becomes a very powerful amplification attack if
online verification is done for records _received passively_.
This means records that were received as the result of a
PUT_VALUE or ADD_PROVIDER. Thus we only accept records we
can verify offline (whose public keys we already have). In
practice this is not at all a problem for us, because
typical connections are encrypted: we've already exchanged
public keys.
2014-12-21 05:45:30 -08:00
Juan Batiz-Benet
cb2e560c32 swarm: add remote pubkey to peerstore 2014-12-21 05:45:29 -08:00
Juan Batiz-Benet
01f7792a4a net: expose local/remote keys on conn 2014-12-21 05:45:29 -08:00
Juan Batiz-Benet
1a432ad69b util: fractional context 2014-12-20 22:28:25 -08:00
Juan Batiz-Benet
d837017bd3 peer: major refactor. builds 2014-12-20 21:26:51 -08:00
Juan Batiz-Benet
c9e4dcbcd6 peerstore: convenience functions 2014-12-20 21:08:04 -08:00
Juan Batiz-Benet
523a576dc2 net/ dialer interface exposes peerstore 2014-12-20 20:06:17 -08:00
Juan Batiz-Benet
e6923ad969 peerstore: PeerInfo func 2014-12-20 14:23:33 -08:00
Juan Batiz-Benet
238ee50110 dht/pb use peer.PeerInfo 2014-12-20 14:02:30 -08:00
Juan Batiz-Benet
74f530e79b routing/mock now uses peer.ID and peer.PeerInfo 2014-12-20 13:51:14 -08:00
Juan Batiz-Benet
7aca07e2be Routing interface uses peer.PeerInfo
Providers are records that need Addresses. The routing
system needs to provide -- not only the ID, but also --
the peer's Addresses. A peer.PeerInfo is a small struct
to pass around a peer.ID and []ma.Multiaddr.
2014-12-20 13:49:22 -08:00
Juan Batiz-Benet
0b12fd65df peer.PeerInfo comment accuracy 2014-12-20 13:39:36 -08:00
Juan Batiz-Benet
02e5692397 kbucket now uses peer.ID 2014-12-20 13:26:52 -08:00
Juan Batiz-Benet
4391ba4ff4 testutil: use crand for PeerID gen
RandPeerID generates random "valid" peer IDs. it does not
NEED to generate keys because it is as if we lost the key
right away. fine to read some randomness and hash it. to
generate proper keys and an ID, use:

  sk, pk, _ := testutil.RandKeyPair()
  id, _ := peer.IDFromPublicKey(pk)

Also added RandPeerIDFatal helper
2014-12-20 13:26:27 -08:00
Juan Batiz-Benet
3c5f484d58 latency metrics 2014-12-19 23:49:36 -08:00
Juan Batiz-Benet
5931546507 updated peer/queue + peerset 2014-12-19 22:24:31 -08:00
Juan Batiz-Benet
423cd2cc8d peer: added a PeerInfo struct
PeerInfo is a small struct used to pass around a peer with
a set of addresses and keys. This is not meant to be a
complete view of the system, but rather to model updates to
the peerstore. It is used by things like the routing system.
2014-12-19 22:23:09 -08:00
Juan Batiz-Benet
20068c8637 peer: added hex enc/dec 2014-12-19 22:22:54 -08:00
Juan Batiz-Benet
a6491df052 backpressure bugfix: w.o.w.
i dont even know how that was passing
2014-12-19 21:56:57 -08:00
Juan Batiz-Benet
b8a3c3d770 backpressure now uses peer.ID 2014-12-19 21:56:30 -08:00
Juan Batiz-Benet
fc56ffee00 mocknet now uses peer.ID 2014-12-19 21:29:12 -08:00
Juan Batiz-Benet
b70f40113d network now uses peer.ID 2014-12-19 21:29:05 -08:00
Juan Batiz-Benet
8ec6f3d34c testutil: RandKeyPair 2014-12-19 21:28:41 -08:00
Juan Batiz-Benet
e535b0e520 swarm now uses peer.ID 2014-12-19 21:05:18 -08:00
Juan Batiz-Benet
35f1d3c236 threadsafe SeededRand 2014-12-19 21:01:14 -08:00
Juan Batiz-Benet
6818090249 peerstore: added privkey holding 2014-12-19 20:10:47 -08:00
Juan Batiz-Benet
618794cbed Moved PeerNetParams + shortened tests 2014-12-19 19:58:17 -08:00
Juan Batiz-Benet
d1b5450875 secio: comment out hyperverbose debugging
this is really only useful when debugging that one pkg.

I wish "debug" could be easily set on only one "pkg" at a time,
making everything else Info+.
2014-12-19 19:46:04 -08:00
Juan Batiz-Benet
57c7ffab44 conn: with new peer.ID 2014-12-19 19:44:59 -08:00
Juan Batiz-Benet
fbee577d3b secio: at last! bugfix found. 2014-12-19 19:36:01 -08:00
Juan Batiz-Benet
16497ed7a3 more secio debugging 2014-12-19 19:35:50 -08:00
Juan Batiz-Benet
c49580044d peer fix: String() uses Pretty 2014-12-19 19:15:37 -08:00
Juan Batiz-Benet
30558d40ff secio debugging 2014-12-19 19:14:57 -08:00
Juan Batiz-Benet
d5c37aefdf testutil vastly simplified peer 2014-12-19 12:34:09 -08:00
Juan Batiz-Benet
fc10d6937d peer: test key/id relationship 2014-12-19 12:29:23 -08:00
Juan Batiz-Benet
32e03413c6 removed handshake3. 2014-12-19 12:20:31 -08:00
Juan Batiz-Benet
d16eb663c4 peer change 2014-12-19 12:20:30 -08:00
Juan Batiz-Benet
8079e04fe2 key marshalling 2014-12-19 12:20:30 -08:00
Juan Batiz-Benet
afd6680208 Merge pull request #438 from jbenet/bitswap-rounds
Bitswap rounds
2014-12-17 23:50:29 -08:00
Brian Tiger Chow
9fafec1256 do not run epic tests in parallel
@whyrusleeping

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:46 -08:00
Jeromy
9328fbaf81 clean peerset constructor names 2014-12-17 23:44:46 -08:00
Brian Tiger Chow
8100582e38 fix: batches of blocks have equal priority
addresses...

https://github.com/jbenet/go-ipfs/pull/438/files#r21878994

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:46 -08:00
Brian Tiger Chow
bd3ee739b9 doc: some comments about the future of the decision engine
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:46 -08:00
Brian Tiger Chow
ce2d0a2258 fix: add lock to taskQueue
@whyrusleeping may wanna have a look and make sure i didn't screw
anything up here

BenchmarkInstantaneousAddCat1MB-4            200          10763761 ns/op
97.42 MB/s
BenchmarkInstantaneousAddCat2MB-4       panic: runtime error: invalid
memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0xbedd]

goroutine 14297 [running]:
github.com/jbenet/go-ipfs/exchange/bitswap/decision.(*taskQueue).Remove(0xc2087553a0,
        0xc2085ef200, 0x22, 0x56f570, 0xc208367a40)
    /Users/btc/go/src/github.com/jbenet/go-ipfs/exchange/bitswap/decision/taskqueue.go:66
    +0x82
github.com/jbenet/go-ipfs/exchange/bitswap/decision.(*Engine).MessageSent(0xc20871b5c0,
        0x56f570, 0xc208367a40, 0x570040, 0xc208753d40, 0x0, 0x0)
    /Users/btc/go/src/github.com/jbenet/go-ipfs/exchange/bitswap/decision/engine.go:177
    +0x29e
github.com/jbenet/go-ipfs/exchange/bitswap.(*bitswap).send(0xc20871b7a0,
        0x56f4d8, 0xc208379800, 0x56f570, 0xc208367a40,
        0x570040, 0xc208753d40, 0x0, 0x0)
    /Users/btc/go/src/github.com/jbenet/go-ipfs/exchange/bitswap/bitswap.go:352
    +0x11c
github.com/jbenet/go-ipfs/exchange/bitswap.(*bitswap).taskWorker(0xc20871b7a0,
        0x56f4d8, 0xc208379800)
    /Users/btc/go/src/github.com/jbenet/go-ipfs/exchange/bitswap/bitswap.go:238
    +0x165
    created by
    github.com/jbenet/go-ipfs/exchange/bitswap.New
    /Users/btc/go/src/github.com/jbenet/go-ipfs/exchange/bitswap/bitswap.go:66
    +0x49e
2014-12-17 23:44:46 -08:00
Brian Tiger Chow
175513e281 refactor(bs/decision.Engine): pass in Entry
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:46 -08:00