Exemplo n.º 1
0
        /// <summary>
        /// Gets the local nodes IP address as seen by the API server.
        /// </summary>
        /// <returns></returns>
        public async Task <string> GetPerceivedIpAddress()
        {
            var client   = new Information.InformationClient(ConnectionManager.ServicesChannel);
            var response = await client.GetClientIpAddressAsync(Empty.Instance);

            return(response.IpAddress);
        }
Exemplo n.º 2
0
        public async Task <ServerVersion> GetServerVersion()
        {
            var client  = new Information.InformationClient(ConnectionManager.ServicesChannel);
            var version = await client.GetServerVersionAsync(Empty.Instance);

            return(new ServerVersion(version.ApiServerVersion.Major, version.ApiServerVersion.Minor,
                                     version.ApiServerVersion.Name));
        }
Exemplo n.º 3
0
        public async Task <bool> VerifyServer(ServerEndpoint serverEndpoint, HttpClient httpClient, CancellationToken stoppingToken)
        {
            var channel = GrpcChannel.ForAddress(serverEndpoint.Uri, new GrpcChannelOptions
            {
                DisposeHttpClient = false,
                HttpClient        = httpClient
            });

            var client = new Information.InformationClient(channel);

            try
            {
                var version = await client.GetServerVersionAsync(Services.Empty.Instance);
            }
            catch
            {
                _logger.LogDebug($"Server couldn't be reached");
                return(false);
            }

            _logger.LogDebug($"Contacted server");

            //  todo: query server for identity credentials
            return(serverEndpoint.IdentityPolicy.IsValid(