package main | |
import ( | |
"bufio" | |
"fmt" | |
"log" | |
"net" | |
"time" | |
"v.io/x/ref/examples/grpc-fortune/vgrpc" | |
) | |
const ( | |
secure = true | |
) | |
func main() { | |
conn, err := net.Dial("tcp", "localhost:8080") | |
if err != nil { | |
panic(err) | |
} | |
if secure { | |
vcred := &vgrpc.VanadiumCred{} | |
secureConn, _, _ := vcred.ClientHandshake("", conn, time.Minute) | |
conn = secureConn | |
} | |
fmt.Fprintf(conn, "Hello.") | |
status, err := bufio.NewReader(conn).ReadString('\n') | |
log.Printf("Client received: %s\n", status) | |
} |