lotus/daemon/rpc.go
Łukasz Magiera 3375a72aea RPC server
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2019-07-01 23:11:33 +02:00

28 lines
470 B
Go

package daemon
import (
"fmt"
"net/http"
"github.com/filecoin-project/go-lotus/build"
"github.com/filecoin-project/go-lotus/rpclib"
)
type Filecoin struct{}
func (*Filecoin) ServerVersion(in int) (string, error) {
fmt.Println(in)
return build.Version, nil
}
func serveRPC() error {
fc := new(Filecoin)
rpcServer := rpclib.NewServer()
rpcServer.Register(fc)
http.Handle("/rpc/v0", rpcServer)
return http.ListenAndServe(":1234", http.DefaultServeMux)
}