func registerGateway(addr string, opts []grpc.DialOption) (*gw.ServeMux, error) { gwmux := gw.NewServeMux() err := pb.RegisterKVHandlerFromEndpoint(context.Background(), gwmux, addr, opts) if err != nil { return nil, err } err = pb.RegisterWatchHandlerFromEndpoint(context.Background(), gwmux, addr, opts) if err != nil { return nil, err } err = pb.RegisterLeaseHandlerFromEndpoint(context.Background(), gwmux, addr, opts) if err != nil { return nil, err } err = pb.RegisterClusterHandlerFromEndpoint(context.Background(), gwmux, addr, opts) if err != nil { return nil, err } err = pb.RegisterMaintenanceHandlerFromEndpoint(context.Background(), gwmux, addr, opts) if err != nil { return nil, err } err = pb.RegisterAuthHandlerFromEndpoint(context.Background(), gwmux, addr, opts) if err != nil { return nil, err } return gwmux, nil }
func (sctx *serveCtx) registerGateway(opts []grpc.DialOption) (*gw.ServeMux, error) { ctx := sctx.ctx addr := sctx.l.Addr().String() gwmux := gw.NewServeMux() err := pb.RegisterKVHandlerFromEndpoint(ctx, gwmux, addr, opts) if err != nil { return nil, err } err = pb.RegisterWatchHandlerFromEndpoint(ctx, gwmux, addr, opts) if err != nil { return nil, err } err = pb.RegisterLeaseHandlerFromEndpoint(ctx, gwmux, addr, opts) if err != nil { return nil, err } err = pb.RegisterClusterHandlerFromEndpoint(ctx, gwmux, addr, opts) if err != nil { return nil, err } err = pb.RegisterMaintenanceHandlerFromEndpoint(ctx, gwmux, addr, opts) if err != nil { return nil, err } err = pb.RegisterAuthHandlerFromEndpoint(ctx, gwmux, addr, opts) if err != nil { return nil, err } return gwmux, nil }