Commit 16533041 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet Committed by Brian Tiger Chow

adjusted what Address means in config

There are (so far) two sorts of addresses that peers care about:

- peer network addresses, local to listen, saved to bootstrap.
  `config.Identity.Address`

- peer RPC network address, local RPC tcp endpoint
  `config.RPCAddress`

@whyrusleeping @perfmode
parent 64ba4cd0
......@@ -71,7 +71,7 @@ func initCmd(c *commander.Command, inp []string) error {
cfg.Identity = new(config.Identity)
// This needs thought
// cfg.Identity.Address = ""
cfg.Identity.Address = "/ip4/127.0.0.1/tcp/4001"
nbits, ok := c.Flag.Lookup("b").Value.Get().(int)
if !ok {
......
......@@ -7,6 +7,8 @@ import (
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
"github.com/jbenet/go-ipfs/daemon"
rofs "github.com/jbenet/go-ipfs/fuse/readonly"
u "github.com/jbenet/go-ipfs/util"
......@@ -42,7 +44,12 @@ func mountCmd(c *commander.Command, inp []string) error {
return err
}
dl, err := daemon.NewDaemonListener(n, "localhost:12345")
maddr, err := ma.NewMultiaddr(n.Config.RPCAddress)
if err != nil {
return err
}
dl, err := daemon.NewDaemonListener(n, maddr)
if err != nil {
return err
}
......
......@@ -30,9 +30,10 @@ type SavedPeer struct {
// Config is used to load IPFS config files.
type Config struct {
Identity *Identity
Datastore Datastore
Peers []*SavedPeer
Identity *Identity // local node's peer identity
Datastore Datastore // local node's storage
RPCAddress string // local node's RPC address
Peers []*SavedPeer // local nodes's bootstrap peers
}
const DefaultPathRoot = "~/.go-ipfs"
......
......@@ -8,10 +8,12 @@ import (
core "github.com/jbenet/go-ipfs/core"
"github.com/jbenet/go-ipfs/core/commands"
u "github.com/jbenet/go-ipfs/util"
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
)
//DaemonListener listens to an initialized IPFS node and can send it commands instead of
//starting up a new set of connections
// DaemonListener listens to an initialized IPFS node and can send it commands instead of
// starting up a new set of connections
type DaemonListener struct {
node *core.IpfsNode
list net.Listener
......@@ -25,8 +27,13 @@ type Command struct {
Opts map[string]interface{}
}
func NewDaemonListener(ipfsnode *core.IpfsNode, addr string) (*DaemonListener, error) {
list, err := net.Listen("tcp", addr)
func NewDaemonListener(ipfsnode *core.IpfsNode, addr *ma.Multiaddr) (*DaemonListener, error) {
network, host, err := addr.DialArgs()
if err != nil {
return nil, err
}
list, err := net.Listen(network, host)
if err != nil {
return nil, err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment