aboutsummaryrefslogtreecommitdiffstats
path: root/node/api.go
diff options
context:
space:
mode:
authorJanos Guljas <janos@resenje.org>2018-02-23 01:50:47 +0800
committerJanos Guljas <janos@resenje.org>2018-02-23 01:51:34 +0800
commit6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e (patch)
tree442ae3e5d75fa5418b362474754d319a7fdfa8f0 /node/api.go
parenta3a07350dcef0ba39829a20d8ddba4bd3463d293 (diff)
parent221486a29109803286c1448426d6180ef5024cf0 (diff)
downloadgo-tangerine-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.tar
go-tangerine-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.tar.gz
go-tangerine-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.tar.bz2
go-tangerine-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.tar.lz
go-tangerine-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.tar.xz
go-tangerine-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.tar.zst
go-tangerine-6a9730edaa3c398ef1e9fe084f9b16de4d3ef78e.zip
swarm, cmd/swarm: Merge branch 'master' into multiple-ens-endpoints
Diffstat (limited to 'node/api.go')
-rw-r--r--node/api.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/node/api.go b/node/api.go
index 1b04b7093..4e9b1edc4 100644
--- a/node/api.go
+++ b/node/api.go
@@ -114,7 +114,7 @@ func (api *PrivateAdminAPI) PeerEvents(ctx context.Context) (*rpc.Subscription,
}
// StartRPC starts the HTTP RPC API server.
-func (api *PrivateAdminAPI) StartRPC(host *string, port *int, cors *string, apis *string) (bool, error) {
+func (api *PrivateAdminAPI) StartRPC(host *string, port *int, cors *string, apis *string, vhosts *string) (bool, error) {
api.node.lock.Lock()
defer api.node.lock.Unlock()
@@ -141,6 +141,14 @@ func (api *PrivateAdminAPI) StartRPC(host *string, port *int, cors *string, apis
}
}
+ allowedVHosts := api.node.config.HTTPVirtualHosts
+ if vhosts != nil {
+ allowedVHosts = nil
+ for _, vhost := range strings.Split(*host, ",") {
+ allowedVHosts = append(allowedVHosts, strings.TrimSpace(vhost))
+ }
+ }
+
modules := api.node.httpWhitelist
if apis != nil {
modules = nil
@@ -149,7 +157,7 @@ func (api *PrivateAdminAPI) StartRPC(host *string, port *int, cors *string, apis
}
}
- if err := api.node.startHTTP(fmt.Sprintf("%s:%d", *host, *port), api.node.rpcAPIs, modules, allowedOrigins); err != nil {
+ if err := api.node.startHTTP(fmt.Sprintf("%s:%d", *host, *port), api.node.rpcAPIs, modules, allowedOrigins, allowedVHosts); err != nil {
return false, err
}
return true, nil