[config] RPCConfig

This commit is contained in:
Ethan Buchman
2017-05-24 13:56:12 -04:00
parent 4f27752468
commit fc6611b2d9
4 changed files with 67 additions and 23 deletions

View File

@ -255,7 +255,7 @@ func (n *Node) OnStart() error {
}
// Run the RPC server
if n.config.RPCListenAddress != "" {
if n.config.RPC.ListenAddress != "" {
listeners, err := n.startRPC()
if err != nil {
return err
@ -320,7 +320,7 @@ func (n *Node) ConfigureRPC() {
func (n *Node) startRPC() ([]net.Listener, error) {
n.ConfigureRPC()
listenAddrs := strings.Split(n.config.RPCListenAddress, ",")
listenAddrs := strings.Split(n.config.RPC.ListenAddress, ",")
// we may expose the rpc over both a unix and tcp socket
listeners := make([]net.Listener, len(listenAddrs))
@ -339,7 +339,7 @@ func (n *Node) startRPC() ([]net.Listener, error) {
}
// we expose a simplified api over grpc for convenience to app devs
grpcListenAddr := n.config.GRPCListenAddress
grpcListenAddr := n.config.RPC.GRPCListenAddress
if grpcListenAddr != "" {
listener, err := grpccore.StartGRPCServer(grpcListenAddr)
if err != nil {
@ -421,7 +421,7 @@ func (n *Node) makeNodeInfo() *p2p.NodeInfo {
p2pListener := n.sw.Listeners()[0]
p2pHost := p2pListener.ExternalAddress().IP.String()
p2pPort := p2pListener.ExternalAddress().Port
rpcListenAddr := n.config.RPCListenAddress
rpcListenAddr := n.config.RPC.ListenAddress
// We assume that the rpcListener has the same ExternalAddress.
// This is probably true because both P2P and RPC listeners use UPnP,