first pass notes
This commit is contained in:
parent
88d35ae193
commit
e0e0420595
2
conn.go
2
conn.go
|
@ -270,7 +270,7 @@ func (d *Daemon) doStreamHandler(req *pb.Request) *pb.Response {
|
||||||
if !ok {
|
if !ok {
|
||||||
d.host.SetStreamHandler(p, d.handleStream)
|
d.host.SetStreamHandler(p, d.handleStream)
|
||||||
}
|
}
|
||||||
log.Debugf("set stream handler: %s -> %s", sp, maddr)
|
log.Debugf("set stream handler: %s -> %s", sp, maddr.String())
|
||||||
d.handlers[p] = maddr
|
d.handlers[p] = maddr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
dht.go
6
dht.go
|
@ -5,11 +5,11 @@ import (
|
||||||
|
|
||||||
pb "github.com/libp2p/go-libp2p-daemon/pb"
|
pb "github.com/libp2p/go-libp2p-daemon/pb"
|
||||||
|
|
||||||
crypto "github.com/libp2p/go-libp2p-crypto"
|
|
||||||
pstore "github.com/libp2p/go-libp2p-peerstore"
|
|
||||||
dht "github.com/libp2p/go-libp2p-kad-dht"
|
|
||||||
cid "github.com/ipfs/go-cid"
|
cid "github.com/ipfs/go-cid"
|
||||||
|
crypto "github.com/libp2p/go-libp2p-crypto"
|
||||||
|
dht "github.com/libp2p/go-libp2p-kad-dht"
|
||||||
peer "github.com/libp2p/go-libp2p-peer"
|
peer "github.com/libp2p/go-libp2p-peer"
|
||||||
|
pstore "github.com/libp2p/go-libp2p-peerstore"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (d *Daemon) doDHT(req *pb.Request) (*pb.Response, <-chan *pb.DHTResponse, func()) {
|
func (d *Daemon) doDHT(req *pb.Request) (*pb.Response, <-chan *pb.DHTResponse, func()) {
|
||||||
|
|
|
@ -4,14 +4,15 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net"
|
||||||
|
|
||||||
ggio "github.com/gogo/protobuf/io"
|
ggio "github.com/gogo/protobuf/io"
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
pb "github.com/libp2p/go-libp2p-daemon/pb"
|
pb "github.com/libp2p/go-libp2p-daemon/pb"
|
||||||
"github.com/libp2p/go-libp2p-peer"
|
"github.com/libp2p/go-libp2p-peer"
|
||||||
ma "github.com/multiformats/go-multiaddr"
|
ma "github.com/multiformats/go-multiaddr"
|
||||||
"github.com/multiformats/go-multiaddr-net"
|
"github.com/multiformats/go-multiaddr-net"
|
||||||
"io"
|
|
||||||
"net"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// StreamInfo wraps the protobuf structure with friendlier types.
|
// StreamInfo wraps the protobuf structure with friendlier types.
|
||||||
|
|
|
@ -77,7 +77,7 @@ func main() {
|
||||||
opts = append(opts, libp2p.NATPortMap())
|
opts = append(opts, libp2p.NATPortMap())
|
||||||
}
|
}
|
||||||
|
|
||||||
d, err := p2pd.NewDaemon(context.Background(), *maddr, opts...)
|
d, err := p2pd.NewDaemon(context.Background(), maddr, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package p2pd
|
package p2pd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/multiformats/go-multiaddr-net"
|
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
ggio "github.com/gogo/protobuf/io"
|
ggio "github.com/gogo/protobuf/io"
|
||||||
inet "github.com/libp2p/go-libp2p-net"
|
inet "github.com/libp2p/go-libp2p-net"
|
||||||
|
"github.com/multiformats/go-multiaddr-net"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (d *Daemon) doStreamPipe(c net.Conn, s inet.Stream) {
|
func (d *Daemon) doStreamPipe(c net.Conn, s inet.Stream) {
|
||||||
|
|
Loading…
Reference in New Issue