move core/net.go to 'corenet' and change interface a tad
Jeromy committed
Feb 14, 2015 at 05:30 UTC
d8d933c862c9be3715cb0783d736fd5f82c9b8df
1 file changed
+4
-4
core/corenet/net.go
renamed
+4
-4
@@ -1,14 +1,14 @@
1
-package core
1
+package corenet
2
3
import (
4
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
5
+ core "github.com/jbenet/go-ipfs/core"
6
net "github.com/jbenet/go-ipfs/p2p/net"
7
peer "github.com/jbenet/go-ipfs/p2p/peer"
8
pro "github.com/jbenet/go-ipfs/p2p/protocol"
9
)
10
11
type ipfsListener struct {
11
- nd *IpfsNode
12
conCh chan net.Stream
13
proto pro.ID
14
ctx context.Context
@@ -30,7 +30,7 @@ func (il *ipfsListener) Close() error {
30
return nil
31
}
32
33
-func (nd *IpfsNode) Listen(protocol string) (*ipfsListener, error) {
33
+func Listen(nd *core.IpfsNode, protocol string) (*ipfsListener, error) {
34
ctx, cancel := context.WithCancel(nd.Context())
35
36
list := &ipfsListener{
@@ -51,6 +51,6 @@ func (nd *IpfsNode) Listen(protocol string) (*ipfsListener, error) {
51
return list, nil
52
}
53
54
-func (nd *IpfsNode) Dial(protocol string, p peer.ID) (net.Stream, error) {
54
+func Dial(nd *core.IpfsNode, p peer.ID, protocol string) (net.Stream, error) {
55
return nd.PeerHost.NewStream(pro.ID(protocol), p)
56
}