MCPcopy
hub / github.com/grpc/grpc-go / main

Function main

interop/alts/server/server.go:48–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46)
47
48func 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.

Callers

nothing calls this directly

Calls 9

ServeMethod · 0.95
DefaultServerOptionsFunction · 0.92
NewServerCredsFunction · 0.92
NewServerFunction · 0.92
CredsFunction · 0.92
InTapHandleFunction · 0.92
NewTestServerFunction · 0.92
ParseMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected