コード例 #1
0
        public ImportProvider_AddEnergie(NetworkType network)
        {
            this.SelectedNetworkType = network;

            ServiceUserName = "******";
            ProviderName    = "AddEnergie";

            if (network == NetworkType.ReseauVER)
            {
                ServiceBaseURL  = "https://admin.reseauver.com";
                ServicePassword = "******";
                ProviderName   += " [ReseauVER]";
            }

            if (network == NetworkType.LeCircuitElectrique)
            {
                ServiceBaseURL  = "https://lecircuitelectrique.co";
                ServicePassword = "******";
                ProviderName   += " [LeCircuitElectrique]";
            }

            AutoRefreshURL = ServiceBaseURL + "/Network/StationsList";


            OutputNamePrefix = "AddEnergie_" + network.ToString();

            IsAutoRefreshed   = false;
            IsProductionReady = true;

            SourceEncoding = Encoding.GetEncoding("UTF-8");

            InitImportProvider();
        }
コード例 #2
0
        /// <summary>
        /// Get initial peer list from GitHub json file
        /// </summary>
        /// <param name="type">MainNet or DevNet</param>
        /// <returns>List of peers (Ip & Port)</returns>
        private async Task <List <ArkPeerAddress> > GetInitialPeerList(NetworkType type)
        {
            LoggingApi.Warn(string.Format("Get initial peer list for <<{0}>>", type.ToString()));
            string json = null;

            using (WebClient wc = new WebClient())
            {
                try
                {
                    json = await wc.DownloadStringTaskAsync(GetPeerSeedListUrl(type)).ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                    LoggingApi.Error(string.Format("Error downloading initial peer list from <<{0}>>", GetPeerSeedListUrl(type)), ex);
                }
            }

            if (!string.IsNullOrEmpty(json))
            {
                return(JsonConvert.DeserializeObject <List <ArkPeerAddress> >(json));
            }

            //Fallback to hardcoded values
            if (type == NetworkType.MainNet)
            {
                return(_peerSeedListMainNet);
            }
            return(_peerSeedListDevNet);
        }
コード例 #3
0
        /// <summary>
        /// Switches the Network
        /// </summary>
        /// <param name="type">
        /// <inheritdoc cref="NetworkType"/> Can be :
        /// -- DevNet (test), ask Dark (testnet coins) on the slack.
        /// -- MainNet (live, beware real money, financial loss possible there).
        /// </param>
        /// <returns> The <inheritdoc cref="Task"/> switches the network.</returns>
        public async Task SwitchNetwork(NetworkType type)
        {
            LoggingApi.Info(string.Format("Switching network to <<{0}>>", type.ToString()));

            NetworkApi.NetworkSettings = null;
            await SetNetworkSettings(await GetInitialPeer(type).ConfigureAwait(false)).ConfigureAwait(false);
        }
コード例 #4
0
        private IGate Create(NetworkType itype)
        {
            IGate result = null;

            var asm = Assembly.GetExecutingAssembly().GetTypes();

            foreach (var type in asm)
            {
                //if (!type.IsClass || type.IsNotPublic) continue;

                Type[] interfaces = type.GetInterfaces();

                if (((IList)interfaces).Contains(typeof(IGate)))
                {
                    if (type.Name.Contains(itype.ToString()))
                    {
                        object obj = Activator.CreateInstance(type);
                        result = (IGate)obj;
                        break;
                    }
                }
            }

            return(result);
        }
コード例 #5
0
        public ImportProvider_AddEnergie(NetworkType network)
        {
            this.SelectedNetworkType = network;

            ServiceUserName = "******";
            ProviderName    = "AddEnergie";

            if (network == NetworkType.ReseauVER)
            {
                ServiceBaseURL  = "https://admin.reseauver.com";
                ServicePassword = System.Configuration.ConfigurationManager.AppSettings["ImportProviderAPIKey_AddEnergieReseauVER"];
                ProviderName   += " [ReseauVER]";
                DataProviderID  = 24;
            }

            if (network == NetworkType.LeCircuitElectrique)
            {
                ServiceBaseURL  = "https://lecircuitelectrique.co";
                ServicePassword = System.Configuration.ConfigurationManager.AppSettings["ImportProviderAPIKey_AddEnergieLeCircuitElectrique"];
                ProviderName   += " [LeCircuitElectrique]";
                DataProviderID  = 24;
            }

            AutoRefreshURL = ServiceBaseURL + "/Network/StationsList";

            OutputNamePrefix = "AddEnergie_" + network.ToString();

            IsAutoRefreshed   = true;
            IsProductionReady = true;

            SourceEncoding = Encoding.GetEncoding("UTF-8");

            //this provider requires InitImportProvider to be called
            ImportInitialisationRequired = true;
        }
コード例 #6
0
        /// <summary>
        /// Start the Network
        /// </summary>
        /// <param name="type">
        /// <inheritdoc cref="NetworkType"/> Can be :
        /// -- DevNet (test), ask Dark (testnet coins) on the slack.
        /// -- MainNet (live, beware real money, financial loss possible there).
        /// </param>
        /// <returns> The <inheritdoc cref="Task"/> starts the node.</returns>
        public async Task Start(NetworkType type, IArkLogger logger = null)
        {
            LoggingApi.Info(string.Format("Starting ArkNet with network <<{0}>>", type.ToString()));

            _arkLogger = logger;
            await SetNetworkSettings(await GetInitialPeer(type).ConfigureAwait(false)).ConfigureAwait(false);
        }
コード例 #7
0
        public ImportProvider_AddEnergie(NetworkType network)
        {
            this.SelectedNetworkType = network;

            ServiceUserName = "******";
            ProviderName = "AddEnergie";

            if (network == NetworkType.ReseauVER)
            {
                ServiceBaseURL = "https://admin.reseauver.com";
                ServicePassword = System.Configuration.ConfigurationManager.AppSettings["ImportProviderAPIKey_AddEnergieReseauVER"];
                ProviderName += " [ReseauVER]";
                DataProviderID = 24;
            }

            if (network == NetworkType.LeCircuitElectrique)
            {
                ServiceBaseURL = "https://lecircuitelectrique.co";
                ServicePassword = System.Configuration.ConfigurationManager.AppSettings["ImportProviderAPIKey_AddEnergieLeCircuitElectrique"];
                ProviderName += " [LeCircuitElectrique]";
                DataProviderID = 24;
            }

            AutoRefreshURL = ServiceBaseURL + "/Network/StationsList";

            OutputNamePrefix = "AddEnergie_" + network.ToString();

            IsAutoRefreshed = true;
            IsProductionReady = true;

            SourceEncoding = Encoding.GetEncoding("UTF-8");

            //this provider requires InitImportProvider to be called
            ImportInitialisationRequired = true;
        }
コード例 #8
0
        public void LoadArgs(IConfiguration conf)
        {
            NetworkType = DefaultConfiguration.GetNetworkType(conf);
            var defaultSettings = BTCPayDefaultSettings.GetDefaultSettings(NetworkType);

            DataDir = conf.GetOrDefault <string>("datadir", defaultSettings.DefaultDataDirectory);
            Logs.Configuration.LogInformation("Network: " + NetworkType.ToString());

            var supportedChains = conf.GetOrDefault <string>("chains", "btc")
                                  .Split(',', StringSplitOptions.RemoveEmptyEntries)
                                  .Select(t => t.ToUpperInvariant());

            NetworkProvider = new BTCPayNetworkProvider(NetworkType).Filter(supportedChains.ToArray());
            foreach (var chain in supportedChains)
            {
                if (NetworkProvider.GetNetwork(chain) == null)
                {
                    throw new ConfigException($"Invalid chains \"{chain}\"");
                }
            }

            var validChains = new List <string>();

            foreach (var net in NetworkProvider.GetAll())
            {
                NBXplorerConnectionSetting setting = new NBXplorerConnectionSetting();
                setting.CryptoCode  = net.CryptoCode;
                setting.ExplorerUri = conf.GetOrDefault <Uri>($"{net.CryptoCode}.explorer.url", net.NBXplorerNetwork.DefaultSettings.DefaultUrl);
                setting.CookieFile  = conf.GetOrDefault <string>($"{net.CryptoCode}.explorer.cookiefile", net.NBXplorerNetwork.DefaultSettings.DefaultCookieFile);
                NBXplorerConnectionSettings.Add(setting);

                {
                    var lightning = conf.GetOrDefault <string>($"{net.CryptoCode}.lightning", string.Empty);
                    if (lightning.Length != 0)
                    {
                        if (!LightningConnectionString.TryParse(lightning, true, out var connectionString, out var error))
                        {
                            Logs.Configuration.LogWarning($"Invalid setting {net.CryptoCode}.lightning, " + Environment.NewLine +
                                                          $"If you have a c-lightning server use: 'type=clightning;server=/root/.lightning/lightning-rpc', " + Environment.NewLine +
                                                          $"If you have a lightning charge server: 'type=charge;server=https://charge.example.com;api-token=yourapitoken'" + Environment.NewLine +
                                                          $"If you have a lnd server: 'type=lnd-rest;server=https://lnd:[email protected];macaroon=abf239...;certthumbprint=2abdf302...'" + Environment.NewLine +
                                                          $"              lnd server: 'type=lnd-rest;server=https://lnd:[email protected];macaroonfilepath=/root/.lnd/admin.macaroon;certthumbprint=2abdf302...'" + Environment.NewLine +
                                                          $"Error: {error}" + Environment.NewLine +
                                                          "This service will not be exposed through BTCPay Server");
                        }
                        else
                        {
                            if (connectionString.IsLegacy)
                            {
                                Logs.Configuration.LogWarning($"Setting {net.CryptoCode}.lightning is a deprecated format, it will work now, but please replace it for future versions with '{connectionString.ToString()}'");
                            }
                            InternalLightningByCryptoCode.Add(net.CryptoCode, connectionString);
                        }
                    }
                }

                ExternalServices.Load(net.CryptoCode, conf);
            }
コード例 #9
0
        public async Task GetFiltersAsync(NetworkType networkType)
        {
            using var client = new WasabiClient(LiveServerTestsFixture.UriMappings[networkType], Global.Instance.TorSocks5Endpoint);
            var filterModel = StartingFilters.GetStartingFilter(Network.GetNetwork(networkType.ToString()));

            FiltersResponse filtersResponse = await client.GetFiltersAsync(filterModel.Header.BlockHash, 2);

            Assert.NotNull(filtersResponse);
            Assert.True(filtersResponse.Filters.Count() == 2);
        }
コード例 #10
0
        private static string GetNetworkType(NetworkType networkType)
        {
            switch (networkType)
            {
            case NetworkType.Mainnet:
                return("livenet");

            default:
                return(networkType.ToString().ToLower());
            }
        }
コード例 #11
0
ファイル: AddressBookService.cs プロジェクト: omcdev/wallet
        public bool VerfyAddress(NetworkType network, string account)
        {
            bool result = false;

            try
            {
                result = AddressTools.AddressVerfy(network.ToString().ToLower(), account);
            }
            catch (Exception ex)
            {
                Logger.Singleton.Error(ex.ToString());
            }
            return(result);
        }
コード例 #12
0
        public Network GetNetwork(NetworkType networkType)
        {
            switch (networkType)
            {
            case NetworkType.Mainnet:
                return(Mainnet);

            case NetworkType.Testnet:
                return(Testnet);

            case NetworkType.Regtest:
                return(Regtest);
            }
            throw new NotSupportedException(networkType.ToString());
        }
コード例 #13
0
 /// <summary>
 /// Generate new BitcoinSecret programmatically or from an imported hexadecimal private key.
 /// /// </summary>
 /// <param name="privateKeyHexString">Optional private key to use for BitcoinSecret generation.</param>
 /// <param name="network">Bitcoin Network (main, test, etc.)</param>
 /// <returns>BitcoinSecret based on the Bitcoin network selected.</returns>
 public BitcoinSecret GetOrCreateSecretFromPrivateKey(string privateKeyHexString = null, NetworkType network = NetworkType.Mainnet)
 {
     if (privateKeyHexString != null)
     {
         if (privateKeyHexString.Length != 64 && !Regex.IsMatch(privateKeyHexString, @"\A\b[0-9a-fA-F]+\b\Z"))
         {
             throw new ArgumentException("Invalid private key. Needs to be a hexadecimal string of length 64.");
         }
         return(new BitcoinSecret(new Key(Enumerable.Range(0, privateKeyHexString.Length / 2).Select(z => Convert.ToByte(privateKeyHexString.Substring(z * 2, 2), 16)).ToArray(), count: 32), Network.GetNetwork(network.ToString().ToLower())));
     }
     else
     {
         return(new BitcoinSecret(new Key(), Network.GetNetwork(network.ToString().ToLower())));
     }
 }
コード例 #14
0
        public void SetBlockPath(string blockPath)
        {
            blockDir = network switch
            {
                NetworkType.MainNet => Path.Combine(blockPath, "Autarkysoft", "Denovo", "Blocks"),
                _ => Path.Combine(blockPath, "Autarkysoft", "Denovo", network.ToString(), "Blocks"),
            };

            if (!Directory.Exists(blockDir))
            {
                Directory.CreateDirectory(blockDir);
            }

            string[] blockFiles = Directory.GetFiles(blockDir, "*.ddat", SearchOption.TopDirectoryOnly);
            for (int i = blockFiles.Length - 1; i >= 0; i--)
            {
                string name = Path.GetFileNameWithoutExtension(blockFiles[i]);
                if (name.Length == 11 &&
                    name.StartsWith("Block") &&
                    int.TryParse(name[5..], out int tempNum) &&
コード例 #15
0
        /// <exception cref="UnauthorizedAccessException"/>
        public FileManager(NetworkType netType)
        {
            network = netType;
            // Main directory is C:\Users\USERNAME\AppData\Roaming\Autarkysoft\Denovo on Windows
            // or ~/.config/Autarkysoft/Denovo on Unix systems such as Linux

            // Note that "Environment.SpecialFolder.ApplicationData" returns the correct ~/.config
            // following XDG Base Directory Specification
            mainDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Autarkysoft", "Denovo");
            // For other networks everything is placed in a separate folder using the network name
            if (netType != NetworkType.MainNet)
            {
                mainDir = Path.Combine(mainDir, netType.ToString());
            }

            if (!Directory.Exists(mainDir))
            {
                Directory.CreateDirectory(mainDir);
            }
        }
コード例 #16
0
        /// <summary>
        /// Encrypt and store the hexadecimal private key in the database. Only one key is allowed per database.
        /// /// </summary>
        /// <param name="hexEncodedPrivateKey"></param>
        /// <param name="password">Password with which to encrypt the key before storing.</param>
        /// <param name="network">Bitcoin network of the key.</param>
        /// <param name="replaceIfExists">Replaces stored key with a new one. Warning when using this since the deletion is irreversable.</param>
        public void StoreEncryptedPrivateKey(string hexEncodedPrivateKey, string password, NetworkType network = NetworkType.Mainnet, bool replaceIfExists = false)
        {
            var secret     = GetOrCreateSecretFromPrivateKey(hexEncodedPrivateKey, network);
            var retrKeyDoc = BitCollection.FindOne(z => z.ContainsKey("BPK1"));

            if (retrKeyDoc != null)
            {
                if (replaceIfExists)
                {
                    BitCollection.Delete(z => z.ContainsKey("BPK1"));
                    InsertBPK1();
                }
            }
            else
            {
                InsertBPK1();
            }
            void InsertBPK1()
            {
                BitCollection.Insert(new BsonDocument {
                    ["BPK1"] = secret.Encrypt(password).ToString(), ["BPK1NW"] = network.ToString().ToLower()
                });
            }
        }
コード例 #17
0
        public void LoadArgs(IConfiguration conf)
        {
            NetworkType = DefaultConfiguration.GetNetworkType(conf);

            Logs.Configuration.LogInformation("Network: " + NetworkType.ToString());

            if (conf.GetOrDefault <bool>("launchsettings", false) && NetworkType != NetworkType.Regtest)
            {
                throw new ConfigException($"You need to run BTCPayServer with the run.sh or run.ps1 script");
            }



            BundleJsCss            = conf.GetOrDefault <bool>("bundlejscss", true);
            DockerDeployment       = conf.GetOrDefault <bool>("dockerdeployment", true);
            AllowAdminRegistration = conf.GetOrDefault <bool>("allow-admin-registration", false);
            TorrcFile = conf.GetOrDefault <string>("torrcfile", null);

            var socksEndpointString = conf.GetOrDefault <string>("socksendpoint", null);

            if (!string.IsNullOrEmpty(socksEndpointString))
            {
                if (!Utils.TryParseEndpoint(socksEndpointString, 9050, out var endpoint))
                {
                    throw new ConfigException("Invalid value for socksendpoint");
                }
                SocksEndpoint = endpoint;
            }

            UpdateUrl = conf.GetOrDefault <Uri>("updateurl", null);

            var sshSettings = ParseSSHConfiguration(conf);

            if ((!string.IsNullOrEmpty(sshSettings.Password) || !string.IsNullOrEmpty(sshSettings.KeyFile)) && !string.IsNullOrEmpty(sshSettings.Server))
            {
                int waitTime = 0;
                while (!string.IsNullOrEmpty(sshSettings.KeyFile) && !File.Exists(sshSettings.KeyFile))
                {
                    if (waitTime++ < 5)
                    {
                        System.Threading.Thread.Sleep(1000);
                    }
                    else
                    {
                        throw new ConfigException($"sshkeyfile does not exist");
                    }
                }

                if (sshSettings.Port > ushort.MaxValue ||
                    sshSettings.Port < ushort.MinValue)
                {
                    throw new ConfigException($"ssh port is invalid");
                }
                if (!string.IsNullOrEmpty(sshSettings.Password) && !string.IsNullOrEmpty(sshSettings.KeyFile))
                {
                    throw new ConfigException($"sshpassword or sshkeyfile should be provided, but not both");
                }
                try
                {
                    sshSettings.CreateConnectionInfo();
                    SSHSettings = sshSettings;
                }
                catch (NotSupportedException ex)
                {
                    Logs.Configuration.LogWarning($"The SSH key is not supported ({ex.Message}), try to generate the key with ssh-keygen using \"-m PEM\". Skipping SSH configuration...");
                }
                catch
                {
                    throw new ConfigException($"sshkeyfilepassword is invalid");
                }
            }

            var fingerPrints = conf.GetOrDefault <string>("sshtrustedfingerprints", "");

            if (!string.IsNullOrEmpty(fingerPrints))
            {
                foreach (var fingerprint in fingerPrints.Split(';', StringSplitOptions.RemoveEmptyEntries))
                {
                    if (!SSHFingerprint.TryParse(fingerprint, out var f))
                    {
                        throw new ConfigException($"Invalid ssh fingerprint format {fingerprint}");
                    }
                    SSHSettings?.TrustedFingerprints.Add(f);
                }
            }

            RootPath = conf.GetOrDefault <string>("rootpath", "/");
            if (!RootPath.StartsWith("/", StringComparison.InvariantCultureIgnoreCase))
            {
                RootPath = "/" + RootPath;
            }
            var old = conf.GetOrDefault <Uri>("internallightningnode", null);

            if (old != null)
            {
                throw new ConfigException($"internallightningnode is deprecated and should not be used anymore, use btclightning instead");
            }

            LogFile = GetDebugLog(conf);
            if (!string.IsNullOrEmpty(LogFile))
            {
                Logs.Configuration.LogInformation("LogFile: " + LogFile);
                Logs.Configuration.LogInformation("Log Level: " + GetDebugLogLevel(conf));
            }

            DisableRegistration = conf.GetOrDefault <bool>("disable-registration", true);
            PluginRemote        = conf.GetOrDefault("plugin-remote", "btcpayserver/btcpayserver-plugins");
            RecommendedPlugins  = conf.GetOrDefault("recommended-plugins", "").ToLowerInvariant().Split('\r', '\n', '\t', ' ').Where(s => !string.IsNullOrEmpty(s)).Distinct().ToArray();
        }
コード例 #18
0
        public override string ToString()
        {
            var  sb      = new StringBuilder("RuyiNetworkSettings(");
            bool __first = true;

            if (Connection != null && __isset.connection)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("Connection: ");
                sb.Append(Connection == null ? "<null>" : Connection.ToString());
            }
            if (NetworkType != null && __isset.networkType)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("NetworkType: ");
                sb.Append(NetworkType == null ? "<null>" : NetworkType.ToString());
            }
            if (Quality != null && __isset.quality)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("Quality: ");
                sb.Append(Quality == null ? "<null>" : Quality.ToString());
            }
            if (SSID != null && __isset.SSID)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("SSID: ");
                sb.Append(SSID == null ? "<null>" : SSID.ToString());
            }
            if (BSSID != null && __isset.BSSID)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("BSSID: ");
                sb.Append(BSSID == null ? "<null>" : BSSID.ToString());
            }
            if (Authentication != null && __isset.Authentication)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("Authentication: ");
                sb.Append(Authentication == null ? "<null>" : Authentication.ToString());
            }
            if (DHCPEnabled != null && __isset.DHCPEnabled)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("DHCPEnabled: ");
                sb.Append(DHCPEnabled == null ? "<null>" : DHCPEnabled.ToString());
            }
            if (IpAddress != null && __isset.IpAddress)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("IpAddress: ");
                sb.Append(IpAddress == null ? "<null>" : IpAddress.ToString());
            }
            if (SubMask != null && __isset.SubMask)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("SubMask: ");
                sb.Append(SubMask == null ? "<null>" : SubMask.ToString());
            }
            if (Gateway != null && __isset.Gateway)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("Gateway: ");
                sb.Append(Gateway == null ? "<null>" : Gateway.ToString());
            }
            if (MainDNS != null && __isset.MainDNS)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("MainDNS: ");
                sb.Append(MainDNS == null ? "<null>" : MainDNS.ToString());
            }
            if (SubDNS != null && __isset.SubDNS)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("SubDNS: ");
                sb.Append(SubDNS == null ? "<null>" : SubDNS.ToString());
            }
            if (MacAddress != null && __isset.MacAddress)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("MacAddress: ");
                sb.Append(MacAddress == null ? "<null>" : MacAddress.ToString());
            }
            if (Proxy != null && __isset.Proxy)
            {
                if (!__first)
                {
                    sb.Append(", ");
                }
                __first = false;
                sb.Append("Proxy: ");
                sb.Append(Proxy == null ? "<null>" : Proxy.ToString());
            }
            sb.Append(")");
            return(sb.ToString());
        }
コード例 #19
0
 /// <summary>
 /// Get the QBitNinja client to be able to read the transaction and balance from the Bitcoin network via its API.
 /// /// </summary>
 /// <param name="network">The Bitcoin network (main, test, etc.)</param>
 /// <returns>The QBitNinja Bitcoin network client.</returns>
 public QBitNinjaClient ConnectToBitcoinNetwork(NetworkType network = NetworkType.Mainnet)
 {
     return(new QBitNinjaClient(Network.GetNetwork(network.ToString().ToLower())));
 }
コード例 #20
0
        public void LoadArgs(IConfiguration conf)
        {
            NetworkType = DefaultConfiguration.GetNetworkType(conf);
            var defaultSettings = BTCPayDefaultSettings.GetDefaultSettings(NetworkType);

            DataDir = conf.GetOrDefault <string>("datadir", defaultSettings.DefaultDataDirectory);
            Logs.Configuration.LogInformation("Network: " + NetworkType.ToString());

            var supportedChains = conf.GetOrDefault <string>("chains", "btc")
                                  .Split(',', StringSplitOptions.RemoveEmptyEntries)
                                  .Select(t => t.ToUpperInvariant());

            NetworkProvider = new BTCPayNetworkProvider(NetworkType).Filter(supportedChains.ToArray());
            foreach (var chain in supportedChains)
            {
                if (NetworkProvider.GetNetwork(chain) == null)
                {
                    throw new ConfigException($"Invalid chains \"{chain}\"");
                }
            }

            var validChains = new List <string>();

            foreach (var net in NetworkProvider.GetAll())
            {
                NBXplorerConnectionSetting setting = new NBXplorerConnectionSetting();
                setting.CryptoCode  = net.CryptoCode;
                setting.ExplorerUri = conf.GetOrDefault <Uri>($"{net.CryptoCode}.explorer.url", net.NBXplorerNetwork.DefaultSettings.DefaultUrl);
                setting.CookieFile  = conf.GetOrDefault <string>($"{net.CryptoCode}.explorer.cookiefile", net.NBXplorerNetwork.DefaultSettings.DefaultCookieFile);
                NBXplorerConnectionSettings.Add(setting);

                {
                    var lightning = conf.GetOrDefault <string>($"{net.CryptoCode}.lightning", string.Empty);
                    if (lightning.Length != 0)
                    {
                        if (!LightningConnectionString.TryParse(lightning, true, out var connectionString, out var error))
                        {
                            throw new ConfigException($"Invalid setting {net.CryptoCode}.lightning, " + Environment.NewLine +
                                                      $"If you have a lightning server use: 'type=clightning;server=/root/.lightning/lightning-rpc', " + Environment.NewLine +
                                                      $"If you have a lightning charge server: 'type=charge;server=https://charge.example.com;api-token=yourapitoken'" + Environment.NewLine +
                                                      $"If you have a lnd server: 'type=lnd-rest;server=https://lnd:[email protected];macaroon=abf239...;certthumbprint=2abdf302...'" + Environment.NewLine +
                                                      $"              lnd server: 'type=lnd-rest;server=https://lnd:[email protected];macaroonfilepath=/root/.lnd/admin.macaroon;certthumbprint=2abdf302...'" + Environment.NewLine +
                                                      error);
                        }
                        if (connectionString.IsLegacy)
                        {
                            Logs.Configuration.LogWarning($"Setting {net.CryptoCode}.lightning will work but use an deprecated format, please replace it by '{connectionString.ToString()}'");
                        }
                        InternalLightningByCryptoCode.Add(net.CryptoCode, connectionString);
                    }
                }

                void externalLnd <T>(string code, string lndType)
                {
                    var lightning = conf.GetOrDefault <string>(code, string.Empty);

                    if (lightning.Length != 0)
                    {
                        if (!LightningConnectionString.TryParse(lightning, false, out var connectionString, out var error))
                        {
                            throw new ConfigException($"Invalid setting {code}, " + Environment.NewLine +
                                                      $"lnd server: 'type={lndType};server=https://lnd.example.com;macaroon=abf239...;certthumbprint=2abdf302...'" + Environment.NewLine +
                                                      $"lnd server: 'type={lndType};server=https://lnd.example.com;macaroonfilepath=/root/.lnd/admin.macaroon;certthumbprint=2abdf302...'" + Environment.NewLine +
                                                      error);
                        }
                        var instanceType = typeof(T);
                        ExternalServicesByCryptoCode.Add(net.CryptoCode, (ExternalService)Activator.CreateInstance(instanceType, connectionString));
                    }
                };

                externalLnd <ExternalLndGrpc>($"{net.CryptoCode}.external.lnd.grpc", "lnd-grpc");
                externalLnd <ExternalLndRest>($"{net.CryptoCode}.external.lnd.rest", "lnd-rest");
            }

            Logs.Configuration.LogInformation("Supported chains: " + String.Join(',', supportedChains.ToArray()));

            PostgresConnectionString = conf.GetOrDefault <string>("postgres", null);
            MySQLConnectionString    = conf.GetOrDefault <string>("mysql", null);
            BundleJsCss = conf.GetOrDefault <bool>("bundlejscss", true);
            ExternalUrl = conf.GetOrDefault <Uri>("externalurl", null);

            var sshSettings = ParseSSHConfiguration(conf);

            if ((!string.IsNullOrEmpty(sshSettings.Password) || !string.IsNullOrEmpty(sshSettings.KeyFile)) && !string.IsNullOrEmpty(sshSettings.Server))
            {
                int waitTime = 0;
                while (!string.IsNullOrEmpty(sshSettings.KeyFile) && !File.Exists(sshSettings.KeyFile))
                {
                    if (waitTime++ < 5)
                    {
                        System.Threading.Thread.Sleep(1000);
                    }
                    else
                    {
                        throw new ConfigException($"sshkeyfile does not exist");
                    }
                }

                if (sshSettings.Port > ushort.MaxValue ||
                    sshSettings.Port < ushort.MinValue)
                {
                    throw new ConfigException($"ssh port is invalid");
                }
                if (!string.IsNullOrEmpty(sshSettings.Password) && !string.IsNullOrEmpty(sshSettings.KeyFile))
                {
                    throw new ConfigException($"sshpassword or sshkeyfile should be provided, but not both");
                }
                try
                {
                    sshSettings.CreateConnectionInfo();
                }
                catch
                {
                    throw new ConfigException($"sshkeyfilepassword is invalid");
                }
                SSHSettings = sshSettings;
            }

            var fingerPrints = conf.GetOrDefault <string>("sshtrustedfingerprints", "");

            if (!string.IsNullOrEmpty(fingerPrints))
            {
                foreach (var fingerprint in fingerPrints.Split(';', StringSplitOptions.RemoveEmptyEntries))
                {
                    if (!SSHFingerprint.TryParse(fingerprint, out var f))
                    {
                        throw new ConfigException($"Invalid ssh fingerprint format {fingerprint}");
                    }
                    TrustedFingerprints.Add(f);
                }
            }

            RootPath = conf.GetOrDefault <string>("rootpath", "/");
            if (!RootPath.StartsWith("/", StringComparison.InvariantCultureIgnoreCase))
            {
                RootPath = "/" + RootPath;
            }
            var old = conf.GetOrDefault <Uri>("internallightningnode", null);

            if (old != null)
            {
                throw new ConfigException($"internallightningnode should not be used anymore, use btclightning instead");
            }

            LogFile = GetDebugLog(conf);
            if (!string.IsNullOrEmpty(LogFile))
            {
                Logs.Configuration.LogInformation("LogFile: " + LogFile);
                Logs.Configuration.LogInformation("Log Level: " + GetDebugLogLevel(conf));
            }
        }
コード例 #21
0
ファイル: Network.cs プロジェクト: cxdcxd/RRS
    /// <summary>
    /// Setup subscriber and publisher for this network
    /// </summary>
    /// <param name="ip"></param>
    /// <param name="only_pub"></param>
    void setup(string ip = "")
    {
        if (state == NetworkState.SETUP && busy == false)
        {
            app_exit_sub = false;
            busy         = true;

            if (type != NetworkType.SUB)
            {
                publisher = new PublisherSocket();

                if (is_subscriber_monitor_enabled)
                {
                    //monitor = new NetMQMonitor(publisher, "inproc://pub.inproc" + local_port, SocketEvents.All);
                    //monitor.Disconnected += Monitor_Disconnected;
                    //monitor.EventReceived += Monitor_EventReceived;
                    //monitor.Accepted += Monitor_Accepted;
                    //monitor.Timeout = new TimeSpan(0, 0, 0, 0, 1000);
                    //Task task = monitor.StartAsync();
                }

                publisher.Bind("tcp://*:" + local_port);

                if (ip == "")
                {
                    ip = remote_ip;
                }

                if (type != NetworkType.PUB)
                {
                    //We shoudl have a subscriber too !
                    subscriber = new SubscriberSocket();
                    subscriber.Subscribe("");
                    subscriber.Connect("tcp://" + ip + ":" + remote_port);
                    sub_thread = new System.Threading.Thread(new System.Threading.ThreadStart(zmqSubThread));
                    sub_thread.Start();
                }

                delegateNewLog?.Invoke("Creating new network for remote: " + remote_ip + " and port: " + remote_port + " " + type.ToString(), RRS.Tools.Log.LogType.INFO, section);
                state = NetworkState.CONNECTED;
                busy  = false;
            }
        }
    }
コード例 #22
0
 public void OpenNetwork(NetworkType type)
 {
     NetworkList.FindElement(By.CssSelector($"a[data-share-channel='{type.ToString().ToLower()}']")).Click();
     _driver.SwitchToLastTab();
     _driver.WaitForTabOpen();
 }
コード例 #23
0
        public void LoadArgs(IConfiguration conf)
        {
            NetworkType = DefaultConfiguration.GetNetworkType(conf);
            var defaultSettings = BTCPayDefaultSettings.GetDefaultSettings(NetworkType);

            DataDir = conf.GetOrDefault <string>("datadir", defaultSettings.DefaultDataDirectory);
            Logs.Configuration.LogInformation("Network: " + NetworkType.ToString());

            var supportedChains = conf.GetOrDefault <string>("chains", "btc")
                                  .Split(',', StringSplitOptions.RemoveEmptyEntries)
                                  .Select(t => t.ToUpperInvariant());

            NetworkProvider = new BTCPayNetworkProvider(NetworkType).Filter(supportedChains.ToArray());
            foreach (var chain in supportedChains)
            {
                if (NetworkProvider.GetNetwork(chain) == null)
                {
                    throw new ConfigException($"Invalid chains \"{chain}\"");
                }
            }

            var validChains = new List <string>();

            foreach (var net in NetworkProvider.GetAll())
            {
                NBXplorerConnectionSetting setting = new NBXplorerConnectionSetting();
                setting.CryptoCode  = net.CryptoCode;
                setting.ExplorerUri = conf.GetOrDefault <Uri>($"{net.CryptoCode}.explorer.url", net.NBXplorerNetwork.DefaultSettings.DefaultUrl);
                setting.CookieFile  = conf.GetOrDefault <string>($"{net.CryptoCode}.explorer.cookiefile", net.NBXplorerNetwork.DefaultSettings.DefaultCookieFile);
                NBXplorerConnectionSettings.Add(setting);
                var lightning = conf.GetOrDefault <string>($"{net.CryptoCode}.lightning", string.Empty);
                if (lightning.Length != 0)
                {
                    if (!LightningConnectionString.TryParse(lightning, true, out var connectionString, out var error))
                    {
                        throw new ConfigException($"Invalid setting {net.CryptoCode}.lightning, " + Environment.NewLine +
                                                  $"If you have a lightning server use: 'type=clightning;server=/root/.lightning/lightning-rpc', " + Environment.NewLine +
                                                  $"If you have a lightning charge server: 'type=charge;server=https://charge.example.com;api-token=yourapitoken'" + Environment.NewLine +
                                                  $"If you have a lnd server: 'type=lnd-rest;server=https://lnd:[email protected];macaron=abf239...;certthumbprint=2abdf302...'");
                    }
                    if (connectionString.IsLegacy)
                    {
                        Logs.Configuration.LogWarning($"Setting {net.CryptoCode}.lightning will work but use an deprecated format, please replace it by '{connectionString.ToString()}'");
                    }
                    InternalLightningByCryptoCode.Add(net.CryptoCode, connectionString);
                }
            }

            Logs.Configuration.LogInformation("Supported chains: " + String.Join(',', supportedChains.ToArray()));

            PostgresConnectionString = conf.GetOrDefault <string>("postgres", null);
            BundleJsCss = conf.GetOrDefault <bool>("bundlejscss", true);
            ExternalUrl = conf.GetOrDefault <Uri>("externalurl", null);

            RootPath = conf.GetOrDefault <string>("rootpath", "/");
            if (!RootPath.StartsWith("/", StringComparison.InvariantCultureIgnoreCase))
            {
                RootPath = "/" + RootPath;
            }
            var old = conf.GetOrDefault <Uri>("internallightningnode", null);

            if (old != null)
            {
                throw new ConfigException($"internallightningnode should not be used anymore, use btclightning instead");
            }
        }
コード例 #24
0
 public string GetNetworkLink(NetworkType type)
 {
     return(_socialNetworkFactory.Create(NetworkList
                                         .FindElement(By.CssSelector($"a[data-share-channel='{type.ToString().ToLower()}']")))
            .Link);
 }
コード例 #25
0
ファイル: Network.cs プロジェクト: kingdom442/ConnectUs
 public Network(NetworkType networkType)
 {
     this.Id = (Int16)networkType;
     this.Name = networkType.ToString();
 }
コード例 #26
0
 public override string ToString()
 {
     return(NetworkType.ToString());
 }
コード例 #27
0
        public async Task GetFiltersAsync(NetworkType networkType)
        {
            using (var client = new WasabiClient(LiveServerTestsFixture.UriMappings[networkType]))
            {
                var filterModel = IndexDownloader.GetStartingFilter(Network.GetNetwork(networkType.ToString()));

                FiltersResponse filtersResponse = await client.GetFiltersAsync(filterModel.BlockHash, 2);

                Assert.NotNull(filtersResponse);
                Assert.True(filtersResponse.Filters.Count() == 2);
            }
        }
コード例 #28
0
        public void LoadArgs(IConfiguration conf)
        {
            NetworkType = DefaultConfiguration.GetNetworkType(conf);
            var defaultSettings = BTCPayDefaultSettings.GetDefaultSettings(NetworkType);

            DataDir = conf.GetOrDefault <string>("datadir", defaultSettings.DefaultDataDirectory);
            Logs.Configuration.LogInformation("Network: " + NetworkType.ToString());

            var supportedChains = conf.GetOrDefault <string>("chains", "btc")
                                  .Split(',', StringSplitOptions.RemoveEmptyEntries)
                                  .Select(t => t.ToUpperInvariant());

            NetworkProvider = new BTCPayNetworkProvider(NetworkType).Filter(supportedChains.ToArray());
            foreach (var chain in supportedChains)
            {
                if (NetworkProvider.GetNetwork(chain) == null)
                {
                    throw new ConfigException($"Invalid chains \"{chain}\"");
                }
            }

            var validChains = new List <string>();

            foreach (var net in NetworkProvider.GetAll())
            {
                NBXplorerConnectionSetting setting = new NBXplorerConnectionSetting();
                setting.CryptoCode  = net.CryptoCode;
                setting.ExplorerUri = conf.GetOrDefault <Uri>($"{net.CryptoCode}.explorer.url", net.NBXplorerNetwork.DefaultSettings.DefaultUrl);
                setting.CookieFile  = conf.GetOrDefault <string>($"{net.CryptoCode}.explorer.cookiefile", net.NBXplorerNetwork.DefaultSettings.DefaultCookieFile);
                NBXplorerConnectionSettings.Add(setting);
                var lightning = conf.GetOrDefault <string>($"{net.CryptoCode}.lightning", string.Empty);
                if (lightning.Length != 0)
                {
                    if (!LightningConnectionString.TryParse(lightning, out var connectionString, out var error))
                    {
                        throw new ConfigException($"Invalid setting {net.CryptoCode}.lightning, you need to pass either " +
                                                  $"the absolute path to the unix socket of a running CLightning instance (eg. /root/.lightning/lightning-rpc), " +
                                                  $"or the url to a charge server with crendetials (eg. https://apitoken@API_TOKEN_SECRET:charge.example.com/)");
                    }
                    InternalLightningByCryptoCode.Add(net.CryptoCode, connectionString);
                }
            }

            Logs.Configuration.LogInformation("Supported chains: " + String.Join(',', supportedChains.ToArray()));

            PostgresConnectionString = conf.GetOrDefault <string>("postgres", null);
            BundleJsCss = conf.GetOrDefault <bool>("bundlejscss", true);
            ExternalUrl = conf.GetOrDefault <Uri>("externalurl", null);

            RootPath = conf.GetOrDefault <string>("rootpath", "/");
            if (!RootPath.StartsWith("/", StringComparison.InvariantCultureIgnoreCase))
            {
                RootPath = "/" + RootPath;
            }
            var old = conf.GetOrDefault <Uri>("internallightningnode", null);

            if (old != null)
            {
                throw new ConfigException($"internallightningnode should not be used anymore, use btclightning instead");
            }
        }
コード例 #29
0
ファイル: Constants.cs プロジェクト: umlspec/Catalyst
 public static string NetworkConfigFile(NetworkType networkType, string overrideNetworkFile = null)
 {
     return(overrideNetworkFile ?? string.Format(JsonFilePattern, networkType.ToString().ToLowerInvariant()));
 }
コード例 #30
0
        //BUILD
        /// <summary>Builds an application using the passed in parameters.</summary>
        /// <param name="targetPlatform">BuildTarget.StandaloneWindows64, StandaloneLinux64, StandaloneOSX</param>
        /// <param name="buildType">NetworkType.Server - Client - HostAndPlay</param>
        /// <param name="headless">Build in headless mode? (console application)</param>
        public static void Build(BuildTarget targetPlatform, NetworkType buildType, bool headless = false)
        {
            ChangeBuildMenu.SetBuildType(buildType, headless); //ACTIVATE CHANGE BUILD MENU

            FileExtension buildFileExtension = FileExtension.exe;

            switch (targetPlatform)
            {
            //STANDALONE
            case BuildTarget.StandaloneWindows64: buildFileExtension = FileExtension.exe; break;

            case BuildTarget.StandaloneWindows: buildFileExtension = FileExtension.exe; break;

            case BuildTarget.StandaloneLinux64: buildFileExtension = FileExtension.x86_64; break;

            case BuildTarget.StandaloneOSX: buildFileExtension = FileExtension.app; break;

                /*TODO
                 *  //MOBILE
                 * case BuildTarget.iOS: break;
                 * case BuildTarget.Android: break;
                 *  //CONSOLE
                 * case BuildTarget.PS4: break;
                 * case BuildTarget.XboxOne: break;
                 * case BuildTarget.Switch: break;
                 *  //WEB
                 * case BuildTarget.WebGL: break;
                 *  //OTHER
                 * case BuildTarget.WSAPlayer: break;
                 * case BuildTarget.tvOS: break;
                 * case BuildTarget.Lumin: break;
                 * case BuildTarget.Stadia: break;
                 * case BuildTarget.NoTarget: break;
                 */
            }

            //SETUP BUILD OPTIONS
            BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();

            buildPlayerOptions.scenes           = GetScenesFromBuild();
            buildPlayerOptions.locationPathName = "_BUILD" + "/" + buildType.ToString().ToUpper() + "/" + targetPlatform + "/" + buildType.ToString().ToLower() + "." + buildFileExtension;
            buildPlayerOptions.target           = targetPlatform;
            buildPlayerOptions.options          = (headless) ? (BuildOptions.EnableHeadlessMode) : (BuildOptions.None);

            #region  BUILD REPORT - header
#if !SKIP_BUILD_REPORT
            buildLog.AppendLine("<b>[BUILD] " + targetPlatform + " - " + ((headless) ? "(headless) " : "") + buildType + "</b>"
                                + "\n" + buildPlayerOptions.locationPathName);

            foreach (string scenePath in buildPlayerOptions.scenes)
            {
                buildLog.AppendLine(scenePath);
            }
#endif
            #endregion

            //BUILD REPORTING
            BuildReport  report  = BuildPipeline.BuildPlayer(buildPlayerOptions);
            BuildSummary summary = report.summary;

            //SUCCESS
            if (summary.result == BuildResult.Succeeded)
            {
                #region  BUILD REPORT - success
#if !SKIP_BUILD_REPORT
                float sizeInMegabytes = (summary.totalSize / 1024f / 1024f);
                sizeInMegabytes -= sizeInMegabytes % 0.0001f;
                float durationInSeconds = (float)((summary.buildEndedAt - summary.buildStartedAt).TotalSeconds);
                durationInSeconds -= durationInSeconds % 0.01f;

                buildLog.AppendLine("<color=green><b>" + targetPlatform + " " + buildType + " build succeeded..." + "</b></color>"
                                    + ((summary.totalSize > 0) ? ("\nBuild size: " + sizeInMegabytes + " MB") : (""))
                                    + "\nBuild duration: " + durationInSeconds + "s");
#endif
                #endregion
            }
            //FAILURE
            if (summary.result == BuildResult.Failed)
            {
                #region  BUILD REPORT - failure
#if !SKIP_BUILD_REPORT
                buildLog.AppendLine("<color=red><b>" + targetPlatform + " " + buildType + " build failed...</b></color>"
                                    + "\n" + report.ToString());
#endif
                #endregion
            }
        }
コード例 #31
0
        public void LoadArgs(IConfiguration conf)
        {
            NetworkType = DefaultConfiguration.GetNetworkType(conf);

            Logs.Configuration.LogInformation("Network: " + NetworkType.ToString());

            if (conf.GetOrDefault <bool>("launchsettings", false) && NetworkType != NetworkType.Regtest)
            {
                throw new ConfigException($"You need to run BTCPayServer with the run.sh or run.ps1 script");
            }

            var supportedChains = conf.GetOrDefault <string>("chains", "btc")
                                  .Split(',', StringSplitOptions.RemoveEmptyEntries)
                                  .Select(t => t.ToUpperInvariant()).ToHashSet();

            var networkProvider = new BTCPayNetworkProvider(NetworkType);
            var filtered        = networkProvider.Filter(supportedChains.ToArray());

#if ALTCOINS
            supportedChains.AddRange(filtered.GetAllElementsSubChains(networkProvider));
            supportedChains.AddRange(filtered.GetAllEthereumSubChains(networkProvider));
#endif
#if !ALTCOINS
            var onlyBTC = supportedChains.Count == 1 && supportedChains.First() == "BTC";
            if (!onlyBTC)
            {
                throw new ConfigException($"This build of BTCPay Server does not support altcoins");
            }
#endif
            NetworkProvider = networkProvider.Filter(supportedChains.ToArray());
            foreach (var chain in supportedChains)
            {
                if (NetworkProvider.GetNetwork <BTCPayNetworkBase>(chain) == null)
                {
                    throw new ConfigException($"Invalid chains \"{chain}\"");
                }
            }

            var validChains = new List <string>();
            foreach (var net in NetworkProvider.GetAll().OfType <BTCPayNetwork>())
            {
                NBXplorerConnectionSetting setting = new NBXplorerConnectionSetting();
                setting.CryptoCode  = net.CryptoCode;
                setting.ExplorerUri = conf.GetOrDefault <Uri>($"{net.CryptoCode}.explorer.url", net.NBXplorerNetwork.DefaultSettings.DefaultUrl);
                setting.CookieFile  = conf.GetOrDefault <string>($"{net.CryptoCode}.explorer.cookiefile", net.NBXplorerNetwork.DefaultSettings.DefaultCookieFile);
                NBXplorerConnectionSettings.Add(setting);

                {
                    var lightning = conf.GetOrDefault <string>($"{net.CryptoCode}.lightning", string.Empty);
                    if (lightning.Length != 0)
                    {
                        if (!LightningConnectionString.TryParse(lightning, true, out var connectionString, out var error))
                        {
                            Logs.Configuration.LogWarning($"Invalid setting {net.CryptoCode}.lightning, " + Environment.NewLine +
                                                          $"If you have a c-lightning server use: 'type=clightning;server=/root/.lightning/lightning-rpc', " + Environment.NewLine +
                                                          $"If you have a lightning charge server: 'type=charge;server=https://charge.example.com;api-token=yourapitoken'" + Environment.NewLine +
                                                          $"If you have a lnd server: 'type=lnd-rest;server=https://lnd:[email protected];macaroon=abf239...;certthumbprint=2abdf302...'" + Environment.NewLine +
                                                          $"              lnd server: 'type=lnd-rest;server=https://lnd:[email protected];macaroonfilepath=/root/.lnd/admin.macaroon;certthumbprint=2abdf302...'" + Environment.NewLine +
                                                          $"If you have an eclair server: 'type=eclair;server=http://eclair.com:4570;password=eclairpassword;bitcoin-host=bitcoind:37393;bitcoin-auth=bitcoinrpcuser:bitcoinrpcpassword" + Environment.NewLine +
                                                          $"               eclair server: 'type=eclair;server=http://eclair.com:4570;password=eclairpassword;bitcoin-host=bitcoind:37393" + Environment.NewLine +
                                                          $"Error: {error}" + Environment.NewLine +
                                                          "This service will not be exposed through BTCPay Server");
                        }
                        else
                        {
                            if (connectionString.IsLegacy)
                            {
                                Logs.Configuration.LogWarning($"Setting {net.CryptoCode}.lightning is a deprecated format, it will work now, but please replace it for future versions with '{connectionString.ToString()}'");
                            }
                            InternalLightningByCryptoCode.Add(net.CryptoCode, connectionString);
                        }
                    }
                }

                ExternalServices.Load(net.CryptoCode, conf);
            }
コード例 #32
0
 // If we ever want to make an implementation of INetwork that we want in core,
 /// <summary>
 /// Creates a new <see cref="INetwork"/> instance of the specified network type.
 /// </summary>
 /// <param name="networkType">The type of <see cref="INetwork"/> to create.</param>
 /// <returns></returns>
 public static INetwork Create(NetworkType networkType)
 {
     return(MXContainer.Resolve <INetwork>(networkType.ToString()));
 }