MCPcopy Create free account
hub / github.com/CPChain/chain / startHTTP

Method startHTTP

node/node.go:329–345  ·  view source on GitHub ↗

startHTTP initializes and starts the HTTP RPC endpoint.

(endpoint string, apis []rpc.API, modules []string, cors []string, vhosts []string)

Source from the content-addressed store, hash-verified

327
328// startHTTP initializes and starts the HTTP RPC endpoint.
329func (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.
348func (n *Node) stopHTTP() {

Callers 2

startRPCMethod · 0.95
StartRPCMethod · 0.80

Calls 1

InfoMethod · 0.65

Tested by

no test coverage detected