startHTTP initializes and starts the HTTP RPC endpoint.
(endpoint string, apis []rpc.API, modules []string, cors []string, vhosts []string)
| 327 | |
| 328 | // startHTTP initializes and starts the HTTP RPC endpoint. |
| 329 | func (n *Node) startHTTP(endpoint string, apis []rpc.API, modules []string, cors []string, vhosts []string) error { |
| 330 | // Short circuit if the HTTP endpoint isn't being exposed |
| 331 | if endpoint == "" { |
| 332 | return nil |
| 333 | } |
| 334 | listener, handler, err := rpc.StartHTTPEndpoint(endpoint, apis, modules, cors, vhosts) |
| 335 | if err != nil { |
| 336 | return err |
| 337 | } |
| 338 | n.log.Info("HTTP endpoint opened", "url", fmt.Sprintf("http://%s", endpoint), "cors", strings.Join(cors, ","), "vhosts", strings.Join(vhosts, ",")) |
| 339 | // All listeners booted successfully |
| 340 | n.httpEndpoint = endpoint |
| 341 | n.httpListener = listener |
| 342 | n.httpHandler = handler |
| 343 | |
| 344 | return nil |
| 345 | } |
| 346 | |
| 347 | // stopHTTP terminates the HTTP RPC endpoint. |
| 348 | func (n *Node) stopHTTP() { |