()
| 152 | } |
| 153 | |
| 154 | func main() { |
| 155 | flag.Parse() |
| 156 | var opts []grpc.DialOption |
| 157 | if *tls { |
| 158 | if *caFile == "" { |
| 159 | *caFile = data.Path("x509/ca_cert.pem") |
| 160 | } |
| 161 | creds, err := credentials.NewClientTLSFromFile(*caFile, *serverHostOverride) |
| 162 | if err != nil { |
| 163 | log.Fatalf("Failed to create TLS credentials: %v", err) |
| 164 | } |
| 165 | opts = append(opts, grpc.WithTransportCredentials(creds)) |
| 166 | } else { |
| 167 | opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) |
| 168 | } |
| 169 | |
| 170 | conn, err := grpc.NewClient(*serverAddr, opts...) |
| 171 | if err != nil { |
| 172 | log.Fatalf("fail to dial: %v", err) |
| 173 | } |
| 174 | defer conn.Close() |
| 175 | client := pb.NewRouteGuideClient(conn) |
| 176 | |
| 177 | // Looking for a valid feature |
| 178 | printFeature(client, &pb.Point{Latitude: 409146138, Longitude: -746188906}) |
| 179 | |
| 180 | // Feature missing. |
| 181 | printFeature(client, &pb.Point{Latitude: 0, Longitude: 0}) |
| 182 | |
| 183 | // Looking for features between 40, -75 and 42, -73. |
| 184 | printFeatures(client, &pb.Rectangle{ |
| 185 | Lo: &pb.Point{Latitude: 400000000, Longitude: -750000000}, |
| 186 | Hi: &pb.Point{Latitude: 420000000, Longitude: -730000000}, |
| 187 | }) |
| 188 | |
| 189 | // RecordRoute |
| 190 | runRecordRoute(client) |
| 191 | |
| 192 | // RouteChat |
| 193 | runRouteChat(client) |
| 194 | } |
nothing calls this directly
no test coverage detected