Example #1
0
        /// <inheritdoc/>
        public async Task <GrpcGetIPAddressReply> GetIPAddress(GrpcGetIPAddressRequest request, CallContext context = default)
        {
            await SyncContext.Clear;

            try
            {
                return(new GrpcGetIPAddressReply(hyperv.GetIPAddress(request.Address).ToProto()));
            }
            catch (Exception e)
            {
                return(new GrpcGetIPAddressReply(e));
            }
        }
Example #2
0
        /// <summary>
        /// Returns information about a virtual IP address.
        /// </summary>
        /// <param name="address">The desired IP address.</param>
        /// <returns>The <see cref="VirtualIPAddress"/> or <c>null</c> when it doesn't exist.</returns>
        public VirtualIPAddress GetIPAddress(string address)
        {
            if (isAdmin)
            {
                return(hypervClient.GetIPAddress(address: address));
            }
            else
            {
                var request = new GrpcGetIPAddressRequest(address: address);
                var reply   = desktopService.GetIPAddress(request).Result;

                reply.Error.EnsureSuccess();

                return(reply.Address.ToLocal());
            }
        }