trying to get shell to connect over grpc

This commit is contained in:
Tadge Dryja 2015-12-30 17:30:43 -04:00 committed by Olaoluwa Osuntokun
parent 31f3df2183
commit 6647bdd2b8
2 changed files with 10 additions and 5 deletions

@ -12,7 +12,7 @@ import (
) )
var ( var (
serverAddr = flag.String("rpcserver", "127.0.0.1:10000", "The server address in the format of host:port") serverAddr = flag.String("rpcserver", "localhost:10000", "The server address in the format of host:port")
) )
func fatal(err error) { func fatal(err error) {

@ -9,6 +9,7 @@ import (
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
"google.golang.org/grpc" "google.golang.org/grpc"
"li.lan/labs/plasma/lnrpc"
) )
func shell(z *cli.Context) { func shell(z *cli.Context) {
@ -111,18 +112,22 @@ func Shellparse(cmdslice []string) error {
func RpcConnect(args []string) error { func RpcConnect(args []string) error {
// client := getClient(ctx) // client := getClient(ctx)
opts := []grpc.DialOption{grpc.WithInsecure()} opts := []grpc.DialOption{grpc.WithInsecure()}
conn, err := grpc.Dial("127.0.0.1:10000", opts...) conn, err := grpc.Dial("localhost:10000", opts...)
if err != nil { if err != nil {
return (err) return err
} }
state, err := conn.State() state, err := conn.State()
if err != nil { if err != nil {
return (err) return err
} }
fmt.Printf("connection state: %s\n", state.String()) fmt.Printf("connection state: %s\n", state.String())
lnClient := lnrpc.NewLightningClient(conn)
// lnClient.NewAddress(nil, nil, nil) // crashes
err = conn.Close() err = conn.Close()
if err != nil { if err != nil {
return (err) return err
} }
return nil return nil