diff options
31 files changed, 150 insertions, 53 deletions
diff --git a/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs b/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs index 588b624be..f2b193a61 100644 --- a/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs +++ b/Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs @@ -450,9 +450,9 @@ namespace Duplicati.Library.Backend.AlternativeFTP }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { new Uri(_url).Host }; }
}
private static System.IO.Stream StringToStream(string str)
diff --git a/Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs b/Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs index 099eed1b3..c72b53a6f 100644 --- a/Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs +++ b/Duplicati/Library/Backend/AmazonCloudDrive/AmzCD.cs @@ -458,9 +458,27 @@ namespace Duplicati.Library.Backend.AmazonCloudDrive }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get
+ {
+ var contentUrl = string.Empty;
+ var metdataUrl = string.Empty;
+
+ if (m_endPointInfo != null)
+ {
+ if (!string.IsNullOrWhiteSpace(m_endPointInfo.ContentUrl))
+ contentUrl = new Uri(m_endPointInfo.ContentUrl).Host;
+ if (!string.IsNullOrWhiteSpace(m_endPointInfo.MetadataUrl))
+ metdataUrl = new Uri(m_endPointInfo.MetadataUrl).Host;
+ }
+
+ return new string[] {
+ new Uri(CLOUDRIVE_MASTER_URL).Host,
+ contentUrl,
+ metdataUrl
+ };
+ }
}
#endregion
diff --git a/Duplicati/Library/Backend/AzureBlob/AzureBlobBackend.cs b/Duplicati/Library/Backend/AzureBlob/AzureBlobBackend.cs index a6cb8af56..c89ef1a25 100644 --- a/Duplicati/Library/Backend/AzureBlob/AzureBlobBackend.cs +++ b/Duplicati/Library/Backend/AzureBlob/AzureBlobBackend.cs @@ -159,9 +159,9 @@ namespace Duplicati.Library.Backend.AzureBlob } }
- public string DNSName + public string[] DNSName { - get { return null; } + get { return _azureBlob.DnsNames; } }
public void Test() diff --git a/Duplicati/Library/Backend/AzureBlob/AzureBlobWrapper.cs b/Duplicati/Library/Backend/AzureBlob/AzureBlobWrapper.cs index b4925dd02..24cf5cf5b 100644 --- a/Duplicati/Library/Backend/AzureBlob/AzureBlobWrapper.cs +++ b/Duplicati/Library/Backend/AzureBlob/AzureBlobWrapper.cs @@ -36,6 +36,29 @@ namespace Duplicati.Library.Backend.AzureBlob private readonly string _containerName; private readonly CloudBlobContainer _container; + public string[] DnsNames + { + get + { + var lst = new List<string>(); + if (_container != null) + { + if (_container.Uri != null) + lst.Add(_container.Uri.Host);
+
+ if (_container.StorageUri != null) + { + if (_container.StorageUri.PrimaryUri != null) + lst.Add(_container.StorageUri.PrimaryUri.Host); + if (_container.StorageUri.SecondaryUri != null) + lst.Add(_container.StorageUri.SecondaryUri.Host); + } + } + + return lst.ToArray(); + } + } + public AzureBlobWrapper(string accountName, string accessKey, string containerName) { _containerName = containerName; diff --git a/Duplicati/Library/Backend/Backblaze/B2.cs b/Duplicati/Library/Backend/Backblaze/B2.cs index a93afb06d..c692f521a 100644 --- a/Duplicati/Library/Backend/Backblaze/B2.cs +++ b/Duplicati/Library/Backend/Backblaze/B2.cs @@ -422,9 +422,9 @@ namespace Duplicati.Library.Backend.Backblaze get { return Strings.B2.Description; }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { new System.Uri(B2AuthHelper.AUTH_URL).Host, m_helper?.APIDnsName, m_helper?.DownloadDnsName} ; }
}
public void Dispose()
diff --git a/Duplicati/Library/Backend/Backblaze/B2AuthHelper.cs b/Duplicati/Library/Backend/Backblaze/B2AuthHelper.cs index 55197519c..d0d960ff5 100644 --- a/Duplicati/Library/Backend/Backblaze/B2AuthHelper.cs +++ b/Duplicati/Library/Backend/Backblaze/B2AuthHelper.cs @@ -27,7 +27,7 @@ namespace Duplicati.Library.Backend.Backblaze private readonly string m_credentials;
private AuthResponse m_config;
private DateTime m_configExpires;
- private const string AUTH_URL = "https://api.backblazeb2.com/b2api/v1/b2_authorize_account";
+ internal const string AUTH_URL = "https://api.backblazeb2.com/b2api/v1/b2_authorize_account";
public B2AuthHelper(string userid, string password)
: base()
@@ -54,6 +54,26 @@ namespace Duplicati.Library.Backend.Backblaze return url;
}
+ public string APIDnsName
+ {
+ get
+ {
+ if (m_config == null || string.IsNullOrWhiteSpace(m_config.APIUrl))
+ return null;
+ return new System.Uri(m_config.APIUrl).Host;
+ }
+ }
+
+ public string DownloadDnsName
+ {
+ get
+ {
+ if (m_config == null || string.IsNullOrWhiteSpace(m_config.DownloadUrl))
+ return null;
+ return new System.Uri(m_config.DownloadUrl).Host;
+ }
+ }
+
private AuthResponse Config
{
get
diff --git a/Duplicati/Library/Backend/Box/BoxBackend.cs b/Duplicati/Library/Backend/Box/BoxBackend.cs index 71d67227c..67bed1232 100644 --- a/Duplicati/Library/Backend/Box/BoxBackend.cs +++ b/Duplicati/Library/Backend/Box/BoxBackend.cs @@ -337,9 +337,9 @@ namespace Duplicati.Library.Backend.Box }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { new Uri(BOX_API_URL).Host, new Uri(BOX_UPLOAD_URL).Host }; }
}
#endregion
diff --git a/Duplicati/Library/Backend/CloudFiles/CloudFiles.cs b/Duplicati/Library/Backend/CloudFiles/CloudFiles.cs index 62a0cdcc1..71783dfc8 100644 --- a/Duplicati/Library/Backend/CloudFiles/CloudFiles.cs +++ b/Duplicati/Library/Backend/CloudFiles/CloudFiles.cs @@ -290,9 +290,9 @@ namespace Duplicati.Library.Backend get { return true; }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { new Uri(m_authUrl).Host, string.IsNullOrWhiteSpace(m_storageUrl) ? null : new Uri(m_storageUrl).Host }; }
}
public void Get(string remotename, System.IO.Stream stream)
diff --git a/Duplicati/Library/Backend/Dropbox/Dropbox.cs b/Duplicati/Library/Backend/Dropbox/Dropbox.cs index c98ef226d..4374bd8a3 100644 --- a/Duplicati/Library/Backend/Dropbox/Dropbox.cs +++ b/Duplicati/Library/Backend/Dropbox/Dropbox.cs @@ -136,9 +136,9 @@ namespace Duplicati.Library.Backend public string Description { get { return Strings.Dropbox.Description; } }
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { new Uri(DropboxHelper.API_URL).Host, new Uri(DropboxHelper.CONTENT_API_URL).Host }; }
}
public void Test()
diff --git a/Duplicati/Library/Backend/Dropbox/DropboxHelper.cs b/Duplicati/Library/Backend/Dropbox/DropboxHelper.cs index 5573b1c78..15d998d9e 100644 --- a/Duplicati/Library/Backend/Dropbox/DropboxHelper.cs +++ b/Duplicati/Library/Backend/Dropbox/DropboxHelper.cs @@ -11,8 +11,8 @@ namespace Duplicati.Library.Backend {
public class DropboxHelper : OAuthHelper
{
- private const string API_URL = "https://api.dropboxapi.com/2";
- private const string CONTENT_API_URL = "https://content.dropboxapi.com/2";
+ internal const string API_URL = "https://api.dropboxapi.com/2";
+ internal const string CONTENT_API_URL = "https://content.dropboxapi.com/2";
private const int DROPBOX_MAX_CHUNK_UPLOAD = 10 * 1024 * 1024; // 10 MB max upload
private const string API_ARG_HEADER = "DROPBOX-API-arg";
diff --git a/Duplicati/Library/Backend/FTP/FTPBackend.cs b/Duplicati/Library/Backend/FTP/FTPBackend.cs index 6f3e8b9dc..0083afd51 100644 --- a/Duplicati/Library/Backend/FTP/FTPBackend.cs +++ b/Duplicati/Library/Backend/FTP/FTPBackend.cs @@ -355,9 +355,9 @@ namespace Duplicati.Library.Backend }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { new Uri(m_url).Host }; }
}
public void Test()
diff --git a/Duplicati/Library/Backend/File/FileBackend.cs b/Duplicati/Library/Backend/File/FileBackend.cs index dec47fcf1..2436cf74a 100644 --- a/Duplicati/Library/Backend/File/FileBackend.cs +++ b/Duplicati/Library/Backend/File/FileBackend.cs @@ -351,7 +351,7 @@ namespace Duplicati.Library.Backend }
}
- public string DNSName
+ public string[] DNSName
{
get { return null; }
}
diff --git a/Duplicati/Library/Backend/GoogleServices/GoogleCloudStorage.cs b/Duplicati/Library/Backend/GoogleServices/GoogleCloudStorage.cs index 2bca35acb..43d353177 100644 --- a/Duplicati/Library/Backend/GoogleServices/GoogleCloudStorage.cs +++ b/Duplicati/Library/Backend/GoogleServices/GoogleCloudStorage.cs @@ -261,9 +261,9 @@ namespace Duplicati.Library.Backend.GoogleCloudStorage get { return Strings.GoogleCloudStorage.Description; }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { new System.Uri(UPLOAD_API_URL).Host, new System.Uri(API_URL).Host }; }
}
#endregion
diff --git a/Duplicati/Library/Backend/GoogleServices/GoogleDrive.cs b/Duplicati/Library/Backend/GoogleServices/GoogleDrive.cs index 0c69c2813..4d94123f7 100644 --- a/Duplicati/Library/Backend/GoogleServices/GoogleDrive.cs +++ b/Duplicati/Library/Backend/GoogleServices/GoogleDrive.cs @@ -347,9 +347,9 @@ namespace Duplicati.Library.Backend.GoogleDrive }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { new System.Uri(DRIVE_API_URL).Host, new System.Uri(DRIVE_API_UPLOAD_URL).Host }; }
}
#endregion
diff --git a/Duplicati/Library/Backend/HubiC/HubiCBackend.cs b/Duplicati/Library/Backend/HubiC/HubiCBackend.cs index ea42996ca..ec604c063 100644 --- a/Duplicati/Library/Backend/HubiC/HubiCBackend.cs +++ b/Duplicati/Library/Backend/HubiC/HubiCBackend.cs @@ -28,7 +28,7 @@ namespace Duplicati.Library.Backend.HubiC private const string HUBIC_API_URL = "https://api.hubic.com/1.0/";
private const string HUBIC_API_CREDENTIAL_URL = HUBIC_API_URL + "account/credentials";
- private OpenStackStorage m_openstack;
+ private OpenStackHelper m_openstack;
private class HubiCAuthResponse
{
@@ -77,6 +77,17 @@ namespace Duplicati.Library.Backend.HubiC {
get { return AuthToken.endpoint; }
}
+
+ public string EndPointDnsName
+ {
+ get
+ {
+ if (m_token == null || string.IsNullOrWhiteSpace(m_token.endpoint))
+ return null;
+
+ return new Uri(m_token.endpoint).Host;
+ }
+ }
}
public HubiCBackend()
@@ -171,9 +182,9 @@ namespace Duplicati.Library.Backend.HubiC }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { new Uri(HUBIC_API_URL).Host, m_openstack.EndPointDnsName }; }
}
#endregion
diff --git a/Duplicati/Library/Backend/Jottacloud/Jottacloud.cs b/Duplicati/Library/Backend/Jottacloud/Jottacloud.cs index 4f44940be..682525d74 100644 --- a/Duplicati/Library/Backend/Jottacloud/Jottacloud.cs +++ b/Duplicati/Library/Backend/Jottacloud/Jottacloud.cs @@ -318,9 +318,9 @@ namespace Duplicati.Library.Backend get { return true; } }
- public string DNSName + public string[] DNSName { - get { return null; } + get { return new string[] { new Uri(JFS_ROOT).Host, new Uri(JFS_ROOT_UPLOAD).Host }; } }
public void Get(string remotename, System.IO.Stream stream) diff --git a/Duplicati/Library/Backend/Mega/MegaBackend.cs b/Duplicati/Library/Backend/Mega/MegaBackend.cs index 0e6719db9..8bfe731f3 100644 --- a/Duplicati/Library/Backend/Mega/MegaBackend.cs +++ b/Duplicati/Library/Backend/Mega/MegaBackend.cs @@ -260,7 +260,7 @@ namespace Duplicati.Library.Backend.Mega }
}
- public string DNSName
+ public string[] DNSName
{
get { return null; }
}
diff --git a/Duplicati/Library/Backend/OneDrive/OneDrive.cs b/Duplicati/Library/Backend/OneDrive/OneDrive.cs index 4f5a59a98..4f4719d56 100644 --- a/Duplicati/Library/Backend/OneDrive/OneDrive.cs +++ b/Duplicati/Library/Backend/OneDrive/OneDrive.cs @@ -500,9 +500,9 @@ namespace Duplicati.Library.Backend }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { new Uri(WLID_SERVER).Host, new Uri(ONEDRIVE_SERVICE_URL).Host, string.IsNullOrWhiteSpace(m_userid) ? null : string.Format("cid-{0}.users.storage.live.com", m_userid) }; }
}
#endregion
diff --git a/Duplicati/Library/Backend/OpenStack/OpenStackStorage.cs b/Duplicati/Library/Backend/OpenStack/OpenStackStorage.cs index 83c6758be..4d5d90266 100644 --- a/Duplicati/Library/Backend/OpenStack/OpenStackStorage.cs +++ b/Duplicati/Library/Backend/OpenStack/OpenStackStorage.cs @@ -423,9 +423,15 @@ namespace Duplicati.Library.Backend.OpenStack }
}
- public string DNSName
+ public virtual string[] DNSName
{
- get { return null; }
+ get
+ {
+ return new string[] {
+ new System.Uri(m_authUri).Host,
+ string.IsNullOrWhiteSpace(m_simplestorageendpoint) ? null : new System.Uri(m_simplestorageendpoint).Host
+ };
+ }
}
#endregion
diff --git a/Duplicati/Library/Backend/Rclone/Rclone.cs b/Duplicati/Library/Backend/Rclone/Rclone.cs index 67771aeba..d8030ff6d 100644 --- a/Duplicati/Library/Backend/Rclone/Rclone.cs +++ b/Duplicati/Library/Backend/Rclone/Rclone.cs @@ -284,9 +284,9 @@ namespace Duplicati.Library.Backend } }
- public string DNSName + public string[] DNSName { - get { return null; } + get { return new string[] { remote_repo }; } }
public void Test() diff --git a/Duplicati/Library/Backend/S3/S3Backend.cs b/Duplicati/Library/Backend/S3/S3Backend.cs index 08d1eb8e9..79d5aa9ca 100644 --- a/Duplicati/Library/Backend/S3/S3Backend.cs +++ b/Duplicati/Library/Backend/S3/S3Backend.cs @@ -474,9 +474,9 @@ namespace Duplicati.Library.Backend get { return m_wrapper; }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { m_wrapper.DNSHost }; }
}
private string GetFullKey(string name)
diff --git a/Duplicati/Library/Backend/S3/S3Wrapper.cs b/Duplicati/Library/Backend/S3/S3Wrapper.cs index 667d6f5f9..16dd42401 100644 --- a/Duplicati/Library/Backend/S3/S3Wrapper.cs +++ b/Duplicati/Library/Backend/S3/S3Wrapper.cs @@ -38,6 +38,8 @@ namespace Duplicati.Library.Backend protected string m_storageClass;
protected AmazonS3Client m_client;
+ public readonly string DNSHost;
+
public S3Wrapper(string awsID, string awsKey, string locationConstraint, string servername, string storageClass, bool useSSL, Dictionary<string, string> options)
{
var cfg = new AmazonS3Config();
@@ -73,6 +75,7 @@ namespace Duplicati.Library.Backend m_locationConstraint = locationConstraint;
m_storageClass = storageClass;
+ DNSHost = string.IsNullOrWhiteSpace(cfg.ServiceURL) ? null : new Uri(cfg.ServiceURL).Host;
}
public void AddBucket(string bucketName)
diff --git a/Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs b/Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs index 45a8ce8f4..7c9ccf9cf 100644 --- a/Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs +++ b/Duplicati/Library/Backend/SSHv2/SSHv2Backend.cs @@ -369,9 +369,9 @@ namespace Duplicati.Library.Backend }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { m_server }; }
}
}
}
diff --git a/Duplicati/Library/Backend/SharePoint/SharePointBackend.cs b/Duplicati/Library/Backend/SharePoint/SharePointBackend.cs index d011237cc..851927dba 100644 --- a/Duplicati/Library/Backend/SharePoint/SharePointBackend.cs +++ b/Duplicati/Library/Backend/SharePoint/SharePointBackend.cs @@ -115,9 +115,9 @@ namespace Duplicati.Library.Backend } }
- public string DNSName + public string[] DNSName { - get { return null; } + get { return new string[] { m_orgUrl.Host, string.IsNullOrWhiteSpace(m_spWebUrl) ? null : new Utility.Uri(m_spWebUrl).Host }; } }
#endregion diff --git a/Duplicati/Library/Backend/Sia/Sia.cs b/Duplicati/Library/Backend/Sia/Sia.cs index ae9c33fe7..c573de452 100644 --- a/Duplicati/Library/Backend/Sia/Sia.cs +++ b/Duplicati/Library/Backend/Sia/Sia.cs @@ -440,9 +440,9 @@ namespace Duplicati.Library.Backend.Sia } }
- public string DNSName + public string[] DNSName { - get { return null; } + get { return new string[] { new System.Uri(m_apihost).Host }; } }
#endregion diff --git a/Duplicati/Library/Backend/TahoeLAFS/TahoeBackend.cs b/Duplicati/Library/Backend/TahoeLAFS/TahoeBackend.cs index 33ab2a91d..25ce8a82e 100644 --- a/Duplicati/Library/Backend/TahoeLAFS/TahoeBackend.cs +++ b/Duplicati/Library/Backend/TahoeLAFS/TahoeBackend.cs @@ -254,9 +254,9 @@ namespace Duplicati.Library.Backend get { return Strings.TahoeBackend.Description; }
}
- public string DNSName
+ public string[] DNSName
{
- get { return null; }
+ get { return new string[] { new Uri(m_url).Host }; }
}
#endregion
diff --git a/Duplicati/Library/Backend/WEBDAV/WEBDAV.cs b/Duplicati/Library/Backend/WEBDAV/WEBDAV.cs index 97a8127f6..06a09a444 100644 --- a/Duplicati/Library/Backend/WEBDAV/WEBDAV.cs +++ b/Duplicati/Library/Backend/WEBDAV/WEBDAV.cs @@ -313,9 +313,9 @@ namespace Duplicati.Library.Backend get { return Strings.WEBDAV.Description; }
}
- public string DNSName
+ public string[] DNSName
{
- get { return m_dnsName; }
+ get { return new string[] { m_dnsName }; }
}
public void Test()
diff --git a/Duplicati/Library/Interface/IBackend.cs b/Duplicati/Library/Interface/IBackend.cs index 709006e54..ba9571e6f 100644 --- a/Duplicati/Library/Interface/IBackend.cs +++ b/Duplicati/Library/Interface/IBackend.cs @@ -82,9 +82,9 @@ namespace Duplicati.Library.Interface string Description { get; }
/// <summary>
- /// The DNS name used to resolve the IP address for this backend
+ /// The DNS names used to resolve the IP addresses for this backend
/// </summary>
- string DNSName { get; }
+ string[] DNSName { get; }
/// <summary>
/// The purpose of this method is to test the connection to the remote backend.
diff --git a/Duplicati/Library/Main/BackendManager.cs b/Duplicati/Library/Main/BackendManager.cs index 671769527..8d8315a3c 100644 --- a/Duplicati/Library/Main/BackendManager.cs +++ b/Duplicati/Library/Main/BackendManager.cs @@ -526,8 +526,10 @@ namespace Duplicati.Library.Main {
try
{
- if (!string.IsNullOrWhiteSpace(m_backend.DNSName))
- System.Net.Dns.GetHostEntry(m_backend.DNSName);
+ var names = m_backend.DNSName ?? new string[0];
+ foreach(var name in names)
+ if (!string.IsNullOrWhiteSpace(name))
+ System.Net.Dns.GetHostEntry(name);
}
catch
{
diff --git a/Duplicati/UnitTest/RandomErrorBackend.cs b/Duplicati/UnitTest/RandomErrorBackend.cs index 4151a8622..d714f7920 100644 --- a/Duplicati/UnitTest/RandomErrorBackend.cs +++ b/Duplicati/UnitTest/RandomErrorBackend.cs @@ -23,6 +23,13 @@ namespace Duplicati.UnitTest public RandomErrorBackend()
{
}
public RandomErrorBackend(string url, Dictionary<string, string> options)
{
var u = new Library.Utility.Uri(url).SetScheme(WrappedBackend).ToString();
m_backend = (IStreamingBackend)Library.DynamicLoader.BackendLoader.GetBackend(u, options);
}
private void ThrowErrorRandom()
{
if (random.NextDouble() > 0.90)
throw new Exception("Random upload failure");
}
- #region IStreamingBackend implementation
public void Put(string remotename, Stream stream)
{
var uploadError = random.NextDouble() > 0.9;
using(var f = new Library.Utility.ProgressReportingStream(stream, stream.Length, x => { if (uploadError && stream.Position > stream.Length / 2) throw new Exception("Random upload failure"); }))
m_backend.Put(remotename, f);
ThrowErrorRandom();
}
public void Get(string remotename, Stream stream)
{
ThrowErrorRandom();
m_backend.Get(remotename, stream);
ThrowErrorRandom();
}
#endregion
#region IBackend implementation
public IEnumerable<IFileEntry> List()
{
return m_backend.List();
}
public void Put(string remotename, string filename)
{
ThrowErrorRandom();
m_backend.Put(remotename, filename);
ThrowErrorRandom();
}
public void Get(string remotename, string filename)
{
ThrowErrorRandom();
m_backend.Get(remotename, filename);
ThrowErrorRandom();
}
public void Delete(string remotename)
{
ThrowErrorRandom();
m_backend.Delete(remotename);
ThrowErrorRandom();
}
public void Test()
{
m_backend.Test();
}
public void CreateFolder()
{
m_backend.CreateFolder();
}
public string DisplayName
{
get
{
return "Random Error Backend";
}
}
public string ProtocolKey
{
get
{
return "randomerror";
}
}
public IList<ICommandLineArgument> SupportedCommands
{
get
{
if (m_backend == null)
try { return Duplicati.Library.DynamicLoader.BackendLoader.GetSupportedCommands(WrappedBackend + "://"); }
catch { }
return m_backend.SupportedCommands;
}
}
public string Description
{
get
{
return "A testing backend that randomly fails";
}
}
#endregion
#region IDisposable implementation
public void Dispose()
{
if (m_backend != null)
try { m_backend.Dispose(); }
finally { m_backend = null; }
}
#endregion
}
+ #region IStreamingBackend implementation
public void Put(string remotename, Stream stream)
{
var uploadError = random.NextDouble() > 0.9;
using(var f = new Library.Utility.ProgressReportingStream(stream, stream.Length, x => { if (uploadError && stream.Position > stream.Length / 2) throw new Exception("Random upload failure"); }))
m_backend.Put(remotename, f);
ThrowErrorRandom();
}
public void Get(string remotename, Stream stream)
{
ThrowErrorRandom();
m_backend.Get(remotename, stream);
ThrowErrorRandom();
}
#endregion
#region IBackend implementation
public IEnumerable<IFileEntry> List()
{
return m_backend.List();
}
public void Put(string remotename, string filename)
{
ThrowErrorRandom();
m_backend.Put(remotename, filename);
ThrowErrorRandom();
}
public void Get(string remotename, string filename)
{
ThrowErrorRandom();
m_backend.Get(remotename, filename);
ThrowErrorRandom();
}
public void Delete(string remotename)
{
ThrowErrorRandom();
m_backend.Delete(remotename);
ThrowErrorRandom();
}
public void Test()
{
m_backend.Test();
}
public void CreateFolder()
{
m_backend.CreateFolder();
}
+ public string[] DNSName
+ {
+ get
+ {
+ return m_backend.DNSName;
+ }
+ }
public string DisplayName
{
get
{
return "Random Error Backend";
}
}
public string ProtocolKey
{
get
{
return "randomerror";
}
}
public IList<ICommandLineArgument> SupportedCommands
{
get
{
if (m_backend == null)
try { return Duplicati.Library.DynamicLoader.BackendLoader.GetSupportedCommands(WrappedBackend + "://"); }
catch { }
return m_backend.SupportedCommands;
}
}
public string Description
{
get
{
return "A testing backend that randomly fails";
}
}
#endregion
#region IDisposable implementation
public void Dispose()
{
if (m_backend != null)
try { m_backend.Dispose(); }
finally { m_backend = null; }
}
#endregion
}
}
diff --git a/Duplicati/UnitTest/SizeOmittingBackend.cs b/Duplicati/UnitTest/SizeOmittingBackend.cs index baba42555..9f3cb95bf 100644 --- a/Duplicati/UnitTest/SizeOmittingBackend.cs +++ b/Duplicati/UnitTest/SizeOmittingBackend.cs @@ -78,6 +78,13 @@ namespace Duplicati.UnitTest {
m_backend.CreateFolder();
}
+ public string[] DNSName
+ {
+ get
+ {
+ return m_backend.DNSName;
+ }
+ }
public string DisplayName
{
get
|