private MaaService CreateMaaService()
        {
            MaaConnectionInfo maaConnectionInfo = null;

            if (string.IsNullOrEmpty(_apiInfo.Url))
            {
                var randomProvidersDescription = _weightedProviders.GetRandomWeightedSample();
                var individualProviders        = randomProvidersDescription.GetAttestationProviders();
                var randomSpecificProvider     = individualProviders.GetRandomSample();

                maaConnectionInfo = new MaaConnectionInfo()
                {
                    DnsName            = randomSpecificProvider.DnsName,
                    TenantNameOverride = randomSpecificProvider.TenantNameOverride,
                    ForceReconnects    = _forceReconnects,
                    ServicePort        = _apiInfo.ServicePort,
                    UseHttp            = _apiInfo.UseHttp
                };
            }
            else
            {
                maaConnectionInfo = new MaaConnectionInfo()
                {
                    DnsName            = string.Empty,
                    TenantNameOverride = string.Empty,
                    ForceReconnects    = _forceReconnects,
                    ServicePort        = _apiInfo.ServicePort,
                    UseHttp            = _apiInfo.UseHttp
                };
            }

            return(new MaaService(maaConnectionInfo));
        }
Example #2
0
 public MaaService(MaaConnectionInfo connectionInfo)
 {
     _connectionInfo = connectionInfo;
     _uriScheme      = _connectionInfo.UseHttp ? "http" : "https";
     _servicePort    = string.IsNullOrEmpty(_connectionInfo.ServicePort) ? (_connectionInfo.UseHttp ? "80" : "443") : _connectionInfo.ServicePort;
     //Tracer.TraceVerbose($"MaaService constructor - force reconnect flag == {_connectionInfo.ForceReconnects}");
 }