mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 10:49:24 +08:00
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
This commit is contained in:

committed by
Brian Tiger Chow

parent
64ba4cd0df
commit
1653304129
@ -71,7 +71,7 @@ func initCmd(c *commander.Command, inp []string) error {
|
|||||||
|
|
||||||
cfg.Identity = new(config.Identity)
|
cfg.Identity = new(config.Identity)
|
||||||
// This needs thought
|
// 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)
|
nbits, ok := c.Flag.Lookup("b").Value.Get().(int)
|
||||||
if !ok {
|
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/gonuts/flag"
|
||||||
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
|
"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"
|
"github.com/jbenet/go-ipfs/daemon"
|
||||||
rofs "github.com/jbenet/go-ipfs/fuse/readonly"
|
rofs "github.com/jbenet/go-ipfs/fuse/readonly"
|
||||||
u "github.com/jbenet/go-ipfs/util"
|
u "github.com/jbenet/go-ipfs/util"
|
||||||
@ -42,7 +44,12 @@ func mountCmd(c *commander.Command, inp []string) error {
|
|||||||
return err
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,10 @@ type SavedPeer struct {
|
|||||||
|
|
||||||
// Config is used to load IPFS config files.
|
// Config is used to load IPFS config files.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Identity *Identity
|
Identity *Identity // local node's peer identity
|
||||||
Datastore Datastore
|
Datastore Datastore // local node's storage
|
||||||
Peers []*SavedPeer
|
RPCAddress string // local node's RPC address
|
||||||
|
Peers []*SavedPeer // local nodes's bootstrap peers
|
||||||
}
|
}
|
||||||
|
|
||||||
const DefaultPathRoot = "~/.go-ipfs"
|
const DefaultPathRoot = "~/.go-ipfs"
|
||||||
|
@ -8,10 +8,12 @@ import (
|
|||||||
core "github.com/jbenet/go-ipfs/core"
|
core "github.com/jbenet/go-ipfs/core"
|
||||||
"github.com/jbenet/go-ipfs/core/commands"
|
"github.com/jbenet/go-ipfs/core/commands"
|
||||||
u "github.com/jbenet/go-ipfs/util"
|
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
|
// DaemonListener listens to an initialized IPFS node and can send it commands instead of
|
||||||
//starting up a new set of connections
|
// starting up a new set of connections
|
||||||
type DaemonListener struct {
|
type DaemonListener struct {
|
||||||
node *core.IpfsNode
|
node *core.IpfsNode
|
||||||
list net.Listener
|
list net.Listener
|
||||||
@ -25,8 +27,13 @@ type Command struct {
|
|||||||
Opts map[string]interface{}
|
Opts map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDaemonListener(ipfsnode *core.IpfsNode, addr string) (*DaemonListener, error) {
|
func NewDaemonListener(ipfsnode *core.IpfsNode, addr *ma.Multiaddr) (*DaemonListener, error) {
|
||||||
list, err := net.Listen("tcp", addr)
|
network, host, err := addr.DialArgs()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
list, err := net.Listen(network, host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user