()
| 46 | ) |
| 47 | |
| 48 | func main() { |
| 49 | flag.Parse() |
| 50 | |
| 51 | // If the server address starts with `unix:`, then we have a UDS address. |
| 52 | network := "tcp" |
| 53 | address := *serverAddr |
| 54 | if strings.HasPrefix(address, udsAddrPrefix) { |
| 55 | network = "unix" |
| 56 | address = strings.TrimPrefix(address, udsAddrPrefix) |
| 57 | } |
| 58 | lis, err := net.Listen(network, address) |
| 59 | if err != nil { |
| 60 | logger.Fatalf("gRPC Server: failed to start the server at %v: %v", address, err) |
| 61 | } |
| 62 | opts := alts.DefaultServerOptions() |
| 63 | if *hsAddr != "" { |
| 64 | opts.HandshakerServiceAddress = *hsAddr |
| 65 | } |
| 66 | altsTC := alts.NewServerCreds(opts) |
| 67 | grpcServer := grpc.NewServer(grpc.Creds(altsTC), grpc.InTapHandle(authz)) |
| 68 | testgrpc.RegisterTestServiceServer(grpcServer, interop.NewTestServer()) |
| 69 | grpcServer.Serve(lis) |
| 70 | } |
| 71 | |
| 72 | // authz shows how to access client information at the server side to perform |
| 73 | // application-layer authorization checks. |
nothing calls this directly
no test coverage detected