MCPcopy Create free account
hub / github.com/DNAProject/DNA / StartLocalServer

Function StartLocalServer

http/localrpc/local_server.go:40–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38)
39
40func StartLocalServer() error {
41 log.Debug()
42 http.HandleFunc(LOCAL_DIR, rpc.Handle)
43
44 rpc.HandleFunc("getneighbor", rpc.GetNeighbor)
45 rpc.HandleFunc("getnodestate", rpc.GetNodeState)
46 rpc.HandleFunc("startconsensus", rpc.StartConsensus)
47 rpc.HandleFunc("stopconsensus", rpc.StopConsensus)
48 rpc.HandleFunc("setdebuginfo", rpc.SetDebugInfo)
49
50 // TODO: only listen to local host
51 err := http.ListenAndServe(LOCAL_HOST+":"+strconv.Itoa(int(cfg.DefConfig.Rpc.HttpLocalPort)), nil)
52 if err != nil {
53 return fmt.Errorf("ListenAndServe error:%s", err)
54 }
55 return nil
56}

Callers 1

initLocalRpcFunction · 0.92

Calls 3

DebugFunction · 0.92
HandleFuncFunction · 0.92
ErrorfMethod · 0.80

Tested by

no test coverage detected